I've made a code where python reads from a file and then proceeds to print a specific line:
with open('crypto.txt') as f:
lines = f.readlines(1)
crypto = str(lines)
print(crypto)
But the output is for example:
['bitcoin\n']
how do i remove ['\n']
to only get bitcoin
as an output ?
I know that with f.read()
there is no brackets and \n
but I can't choose a specific line to read - or can I?
here is the txt file:
bitcoin
ethereum
cardano
sandbox