def strB2Q(ustring): rstring = "" for uchar in ustring: inside_code = ord(uchar) if inside_code == 32: inside_code = 12288 elif 32 <= inside_code <= 126: inside_code += 65248 rstring += chr(inside_code) return rstring
标签:code,全角,inside,半角,Python,rstring,uchar From: https://www.cnblogs.com/michaelShao/p/17646527.html