Files
cursopython2023/aula89.py
2022-11-04 08:07:35 -03:00

10 lines
209 B
Python

# dir, hasattr e getattr em Python
string = 'Luiz'
metodo = 'strip'
if hasattr(string, metodo):
print('Existe upper')
print(getattr(string, metodo)())
else:
print('Não existe o método', metodo)