I'm a beginner with Python and would appreciate some help. I'm having trouble with the code below as I can't split a file. In my text file I have Gem11 and Gem12 on separate lines and would like to know how to display it in Python in the same format without the quotation marks.
with open ("testpractice01.txt" , "r") as f:
f_contents = f.readlines()
print (f_contents)
f.close()
Here's what python is generating. I'm trying to remove the quotation marks etc so I simply have Gem11 and Gem12 so I can then place these in a variable to search through later:
['Gem11\n', 'Gem12\n']
str.strip()
– cs95 Oct 15 '17 at 18:05