I am trying to convert a python 2 code to python 3, and just came to know the difference the type() function on both versions. I am basically pulling data from a json file using pandas. I have a variable word = 0x00000010.
I wanted to get the value of word from the json file.
so my code goes below
json_data = [Basically this variable have the pulled data from json file]
json_data.get(int(str(word),16), 'none')
gives the value that is present in python 2, but in python 3 it is returning nan
. I am assuming it has something to do with the type(str(word)) which gives class for python 3
I have seen many questions related to this difference, but nothing actually solved my question.
Json file format :
{
"color" : "red",
"sets" :
{
"0x00000010":"yellow",
"0x00000020":"red
}
}
and the json_data contains the dict in "sets"
User contributions licensed under CC BY-SA 3.0