I am trying to create a turtle which goes to the locations on a list and I'm having trouble doing this because my list contains a "\n" after each position. I tried going through the list and changing each one by removing \n from the original to a different one without \n.
I tried lists.strip("\n")
but it doesn't seem to work for me.
def gotoprocess():
with open("one.txt", "r") as rp:
print(rp.readlines())
lists = rp.readlines()
while True:
for i in range(len(lists)):
lists[i]
if lists[i] == lists[-2]:
break
print(lists)
I expected a list that looks like this
['(-300.00,300.00)','(-200.00,200.00)']
but with more numbers. What I got was this
['(-300.00,300.00)\n', '(-200.00,200.00)\n', '(-100.00,300.00)\n', '(-100.00,100.00)\n', '(-300.00,100.00)\n', '(-300.00,300.00)\n', '(-200.00,200.00)\n']