How to Python3 | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

How to Python3

How to compare if variable is a string? like: n = input() if n == (string): print("error string") i dont know the comparison of the placeholder (string)

2nd Apr 2020, 3:54 AM
CutieRei
CutieRei - avatar
2 Respuestas
+ 3
Try: if isinstance(n, str): print("error string")
2nd Apr 2020, 4:16 AM
Qasem
+ 1
Qasem Thanks!
2nd Apr 2020, 5:42 AM
CutieRei
CutieRei - avatar