Answer the question
In order to leave comments, you need to log in
Why is the data displayed incorrectly?
Here is a test program I wrote:
namesList = []
authorsList = []
with open('Saves/names file.txt', 'r') as namesFile:
for line in namesFile:
appendData = line.lower()
namesList.append(appendData)
with open('Saves/authors file.txt', 'r') as authorsFile:
for line in authorsFile:
appendData = line.lower()
authorsList.append(appendData)
for x in range(0, len(namesList)):
print(namesList[x], authorsList[x])
book 1
author 1
book 2 author 2
Answer the question
In order to leave comments, you need to log in
Check the resulting lines for the presence of hyphen characters . You
can remove them like this:
with open('Saves/names file.txt', 'r') as namesFile:
namesList = namesFile.read().splitlines()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question