Question: At the end of each list I get '\n'
How can I remove it?

```
ranexersize = random.randint(1,5)
ranintel = random.randint(1,100)
ranfriend = random.randint(1,10)
randrool = random.randint(1,10)

dogs = []
inp = open('dogs.txt','r')
for line in inp.readlines():
    dogs.append([ranexersize, ranintel, ranfriend, randrool])
    for i in line.split(","):
        dogs[-1].append(i)
inp.close()

```

Output in console:

```

[[4, 85, 6, 1, 'Annie the Afgan Hound', '\n'], [4, 85, 6, 1, 'Bertie the Boxer', '\n'],

```

Answer: 
Python `file.readlines()` gives you a list of strings, bu by default it doesn't strip newlines.

You either should do it yourself (i.e. with `line.strip('\n').split(',')`) or use [csv module](https://docs.python.org/3/library/csv.html) to read file, as it looks like csv format.
use `re` module to replace `\n`:

```
import re
re.sub('\n','',i)

```