Def strQ2B(ustring): ss = [] for s in ustring: rstring = "" inside_code = ord(uchar) if inside_code == 12288: inside_code = 32 elif (inside_code >= 65281 and inside_code <= 65374): Join (ss) # def strB2Q(ustring) def strB2Q(ustring): ss = [] for s in ustring: rstring = "" for uchar in s: inside_code = ord(uchar) if inside_code == 32: inside_code = 12288 elif (inside_code >= 33 and inside_code <= 126): inside_code += 65248 rstring += chr(inside_code) ss.append(rstring) return ''.join(ss) if __name__ == '__main__': Print (a) print(b) print(b)Copy the code