Answers for "how to separate numbers by commas python"

5

format python number with commas

num = int(input())
print(f"{num:,}")

#Hope this helps:)
Posted by: Guest on February-21-2021
1

how to split an input in python by comma

lst = input().split(',')#can use any seperator value inside '' of split
print (lst)
#given input = hello,world
#output: ['hello', 'world']
#another example 
lst = input().split(' ; ')#can use any seperator value inside '' of split
print (lst)
#given input = hello ; world ; hi there
#output: ['hello', 'world', 'hi there']
Posted by: Guest on July-06-2020

Code answers related to "how to separate numbers by commas python"

Python Answers by Framework

Browse Popular Code Answers by Language