Answers for "how to search comma separated values in python"

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
1

how to input comma separated int values in python

lst = list(map(int, input("Enter comma separated values: ").split(",")))
Posted by: Guest on September-25-2020

Code answers related to "how to search comma separated values in python"

Python Answers by Framework

Browse Popular Code Answers by Language