Question: When I try to read from a file, I'm getting an annoying error, I think it's got something to do with the list format of the variables but I'm not sure.

If anyone can help with with this issue that would be great.
I think it's also got something to do with \n being printed at the end of the list.

This is my code:

Option 1
========

```
    def one():
        print ("")
        print ("You have chosen to read the file!")
        print ("")
        file = open("sentence.txt" , "r")
        words = file.readlines(1)
        nums = file.readlines(2)
        #Remove "\n"
        #This bit doesn't work, I'm not sure how to remove "\n" 

        #These were me trying to get rid of the "\n"
        #map(str.strip, words)
        #words = words.strip('\n')

        print(words)
        print (nums)
        print ("")
        #Reconstruct sentence here

```

Answer: 
What `file.readlines(1)` returns is a single element list, and the element is a string. What you want to do get the string itself and replace the '\n', '[', ']', etc.

Try
`words[0].strip("\n][").replace("'", "").split(",")`
You are getting exception at [words[i-1], Because i is str and you can perform -: 'str' and 'int'. 

```
>>> i = '1'
>>> i -1

Traceback (most recent call last):
  File "<pyshell#101>", line 1, in <module>
    i -1
TypeError: unsupported operand type(s) for -: 'str' and 'int'

```

A quick fix should be- 

```
remade_sentence = ''.join([words[int(i)-1] for i in nums])

```