Read file remove newlines
- trim
- rstrip
- chomp
filename = 'examples/files/numbers.txt'
with open(filename, 'r') as fh:
for line in fh:
line = line.rstrip("\n")
print(line)
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
filename = 'examples/files/numbers.txt'
with open(filename, 'r') as fh:
for line in fh:
line = line.rstrip("\n")
print(line)