Reputation:
How to specify multiple separators in split() in python?
input = "print{hello world};x = 2 + 3;"
x = input.split('{') #this works but not the desired OP
x = input.split('{','}') #error
x = input.split('{}') #this works but not the desired OP
Desired OP:
['print', 'hello world', ';x = 2 + 3;']
Upvotes: 4
Views: 103