Quantcast
Channel: User Graygood - Stack Overflow
Viewing all articles
Browse latest Browse all 32

Answer by Graygood for How to convert string number to int and avoid the string text before convert

$
0
0

You could try something like this:

array = ["String", "12"]for item in array:  try:    int(item)    print(f"{item} is not string")  except:    print(f"{item} is string")

Viewing all articles
Browse latest Browse all 32

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>