def s2i(keys, inp, out):
for key in keys:
ind = inp.find(key)
if ind:
typ = TYPES[key]
if ind.contents:
val = ind.contents[0].strip()
try:
if typ == B:
res = (val == 'true')
elif typ == S:
res = str(unescape(val))
elif typ == I:
res = int(round(float(c2p(str(val)))))
else:
res = float(c2p(str(val)))
out.__setattr__(key, res)
except:
pass
评论列表
文章目录