s = "how many gallons
of rain did you drink
cuckoo"
above 3 lines are input ,
I want to create a list=["how many gallons", "of rain did you drink", "cuckoo"]
s = "how many gallons
of rain did you drink
cuckoo"
above 3 lines are input ,
I want to create a list=["how many gallons", "of rain did you drink", "cuckoo"]
Use splitlines
:
print([i.strip() for i in s.splitlines()])
Output:
['how many gallons', 'of rain did you drink', 'cuckoo']