pstr.py 文件源码

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

项目:MacHeap 作者: blankwall 项目源码 文件源码
def __setvalue__(self, value):
        '''Set the _char_t to the str ``value``.'''
        if isinstance(value, __builtin__.str):
            try: value = __builtin__.unicode(value, 'ascii')
            except UnicodeDecodeError: return super(pint.integer_t,self).__setvalue__(str(value))
        elif isinstance(value, __builtin__.unicode):
            value = value
        else:
            raise ValueError(self, '_char_t.set', 'User tried to set a value of an incorrect type : {:s}'.format(value.__class__))
        res = value.encode(self.encoding.name)
        return super(pint.integer_t,self).__setvalue__(res)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号