Detect type of input | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Detect type of input

How to detect type of input like str or int in python? To tell if it True or False

22nd Oct 2018, 3:51 PM
Tan Vireak Punhakvorn
Tan Vireak Punhakvorn - avatar
2 Réponses
+ 2
input always returns a string
22nd Oct 2018, 4:27 PM
jtrh
jtrh - avatar
+ 1
you can use type(var) to get its type, then chect the result if it's int or str
22nd Oct 2018, 4:27 PM
Taste
Taste - avatar