注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
觉得有用请加米,json parser
"""
element -> array|string|number
number -> non-negative integer, allows leading 0's
string -> surrouned by "", \" escapes a quote in the middle of the string, \\ escapes backslash, other escapes invalid
array -> [comma separated list of element], no whitespace allowed between tokens
'123' -> 123
'004' -> 4
'"hi"' -> 'hi'
'"h\"i"' -> 'h"i'
json[0] = " s = ''
while i < n and isNumber():
s += input[i]
i += 1
# print('a', i, input[i], s)
return int(s)
return parseHelper()
print(parseJson2('[9876543321,[5,[0,1]]]'))
print(parseJson2('[["avx\\"",123],[0412]]')) |