split a string input an input in two list python code example
Example 1: get list input from user in python
a = list(map(int,input("\nEnter the numbers : ").strip().split()))
Example 2: how to split a string in python with multiple delimiters
>>> a='Beautiful, is; better*than\nugly'
>>> import re
>>> re.split('; |, |\*|\n',a)
['Beautiful', 'is', 'better', 'than', 'ugly']
Example 3: how to split an input in python by comma
lst = input().split(',')
print (lst)
lst = input().split(' ; ')
print (lst)
Example 4: get list as input
integer_list = list(map(int, input().split()))
str_list = list(map(str, input().split()))