i am getting syntax error while executing words[list(eval(s).keys())[0]] = list(eval(s).values())[0]; where words is an empty dictionary and s is my dictionary with string keys and values in a text file.
Can some one please help with the error ?
i am getting syntax error while executing words[list(eval(s).keys())[0]] = list(eval(s).values())[0]; where words is an empty dictionary and s is my dictionary with string keys and values in a text file.
Below is the error:
words[list(eval(s).keys())[0]] = list(eval(s).values())[0]
File "<string>", line 1
s= {'water':{'german':'wasser','french':'leau','spanish':'agua'},
^
SyntaxError: invalid syntax
Can some one please help with the error ?
evalis for expressions, not statements (such as an assignment). It cannot accept thes=part. That said: Do not ever useeval(orexec) on data that could possibly come from outside the program in any form. It is a critical security risk. You allow the author of the data to run arbitrary code on your computer.