我需要我的随机响应是我存储在txt文件中的句子或字符串.
import random
import time
question = input("Ask the magic 8 ball a question (press enter to quit): ")
while question:
if question == "quit":
break
print("Let's see what your future holds")
print("Let me check real quick")
for i in range(random.randrange(3,10)):
print(". ",end=" ")
time.sleep(1)
print("\nYour answer is")
print("Your future is " + (random.choice(open("responses.txt","r").readline().split())) + " .")
question = input("Ask the magic 8 ball a question (press enter to quit): ")
print("See ya")
回答txt: