views.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:legal 作者: tompecina 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号