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 jsondecodeerrorwould thrown.


Comments

Popular posts from this blog

php - How can I edit my code to echo the data of child's element where my search term was found in, in XMLReader? -

java - Why is BlockingQueue.take() not releasing the thread? -

jQuery Ajax Render Fragments OR Whole Page -