import json
user_input = input("**^**: ").lower()
#d
if (user_input == "learn"):
backslash = "\\"
phrase = input("What phrase do you want me to reply to: ")
answer = input("What do you want me to answer: ")
#Checks for illegal signs
if backslash in phrase and backslash in answer:
print ("Contains illegal signs")
else:
print("I leant something new")
data = {}
data[phrase] = []
data[phrase].append({
'phrase': phrase,
'answer': answer
})
with open('data.txt', 'w') as outfile:
json.dump(data, outfile)
that is my script that put the user input into a file to later use. My problem is i dont know how to make it go back to user_input = input("**^**: ").lower()