I want to split a string with both ", " and ",". So I have to make a program in which I take input from the user, which is like:- 4, 16, 8, etc. and then double each the number. This is what I have written so far:-
def main():
a = []
def Convert(string):
li = list(string.split(", "))
return li
def double(lst):
for i, x in enumerate(lst):
x = int(x)
x = x+x
a.append(x)
str1 = input()
n = Convert(str1)
f = double(n)
print(a)
if __name__ == "__main__":
main()
#Results
inp = 14, -4, 8
out = 28, -8, 16
inp = 14,-4,8
out = error
That's why I want to make it so that it will split with ", " and ",". Pls help