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 Antworten
+ 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