I'm using the following code to split up a large text file into chunks of 100
.
import itertools
import pprint
with open('usernames.txt') as f:
while True:
lines = list(itertools.islice(f, 100)) # similar to `f[0:100]`
if not lines:
break
print lines
However when I print, every line has a /n
of course, now I was wondering on how to rid of them.
As lines.rstrip('/n')
does not work, neither does .remove()
.