I have this name list that i got online,the list is 200 names long,here is a sample of it that i have saved in a text file.
John
Noah
William
James
Logan
Benjamin
...
I want them to be a list of strings i.e
x=['John','Noah','William',...]
I searched for questions similar but didn't find exactly what i need, any help is much appreciated.
If the input is a file you can do...
x = []
with open('file_name', 'r') as f:
for line in f:
x.append(line.strip())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With