Python eval integer in string, and return integer instead of ascii char -
i'm getting data file, looks this:
[200, "hello", "world"]
now, since file, array inside string; turn array using eval()
. works fine integer @ start converted ascii char, instead of integer want (the euro sign).
how can fix this?
you use simplejson module. e.g.
>>> import simplejson >>> = simplejson.loads('[200, "hello", "world"]') >>> print [200, 'hello', 'world']
this way "malicious" data such os.execvp()
not evaluated jsondecodeerror
would thrown.
Comments
Post a Comment