Util.py 文件源码

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

项目:StatisKit 作者: StatisKit 项目源码 文件源码
def to_String_for_subst(s,
                        isinstance=isinstance, str=str, to_String=to_String,
                        BaseStringTypes=BaseStringTypes, SequenceTypes=SequenceTypes,
                        UserString=UserString):

    # Note that the test cases are sorted by order of probability.
    if isinstance(s, BaseStringTypes):
        return s
    elif isinstance(s, SequenceTypes):
        l = []
        for e in s:
            l.append(to_String_for_subst(e))
        return ' '.join( s )
    elif isinstance(s, UserString):
        # s.data can only be either a unicode or a regular
        # string. Please see the UserString initializer.
        return s.data
    else:
        return str(s)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号