I'm trying to concatenate a string pulled from a file with a string literal and getting an error.
Example:
file.txt:
string1
string2
string3
program.py:
import random
f = open("file.txt", "r")
alist = f.readlines()
f.close()
anotherlist = ['word1', 'word2']
astring = random.choice(alist) + " " + random.choice(anotherlist)
print(astring)
It prints the variable it pulled from the .txt file, but it won't print anything after that.