I'm attempting to return out a function but can't find an adequate solution
def importer():
with open('books.txt','r') as f:
for line in f:
books = line.strip().split(',')
print(books)
with open('ratings.txt','r') as f:
for line in f:
ratings = line.strip().split(' ')
print(ratings)
return ratings,books
importer()
print(books,ratings)
Using this method the dictionaries are empty again when I get outside my function. To get one out I'd set the function up like
books = importer()
but unsure how to do it for multiple dictionaries