About the problem of python's integer (int) automatic conversion to length shaping (long)

Sometimes it is necessary to access an interface, and the incoming integer parameter may be long and become long. At this time, if str() is used, 'L' will be converted into a string, resulting in the interface not being recognized;

In this case, json should be used first for translation, which can perfectly maintain the syntax of translating python, as follows:

a=[11111111111,22222222222]
c=list(a)
<<<<<<
In [11]: c
Out[11]: [11111111111L, 22222222222L]
<<<<<<
In [12]: str(c)
Out[12]: '[11111111111L, 22222222222L]'
<<<<<<
In [14]: json.dumps(c)
Out[14]: '[11111111111, 22222222222]'

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325000124&siteId=291194637