I have no idea why I get a syntax error in my python code even though I checkt in all docs how the commands need to be. This is my code:
class Agent: # Agent class which pickle can dump to a file
def __init__(self, name, userName):
self.name = name
self.context = ""
self.conversation = ""
self.userName = userName
def save(self): # Saves the agent object to a file
file = open(f"{self.name}.mtrx", "wb")
pickle.dump(self, file)
file.close()
And the error message is within this line:
file = open(f"{self.name}.mtrx", "wb")
^
SyntaxError: invalid syntax
Is the error maybe somewhere else but the compiler spots it there or is actually something wrong about this line of code?
3.6
. – Axe319import sys; print(sys.version_info)
at the top of your script and you will see the version you are actually running. – Marco Bonelli