Skip to content

Instantly share code, notes, and snippets.

@goyalrohit
Created September 22, 2019 06:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goyalrohit/e802db7640600a34295f747681930b02 to your computer and use it in GitHub Desktop.
Save goyalrohit/e802db7640600a34295f747681930b02 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
#string with commas
millions = '25,000,000'
#convert to integer
intMillions = int(millions.replace(',',''))
print (intMillions)
#list of strings
list_str = ['2019', '2020', '2021']
#convert to list of integers
list_int = [int(a) for a in list_str]
print (list_int)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment