python全角与半角
全角转半角:
https://www.jianshu.com/p/a5d96457c4a4
半角转全角:
- def half2full(half):
- full = ''
- for ch in half:
- if ord(ch) in range(33, 127):
- ch = chr(ord(ch) + 0xfee0)
- elif ord(ch) == 32:
- ch = chr(0x3000)
- else:
- pass
- full += ch
- return full
全角转半角:
https://www.jianshu.com/p/a5d96457c4a4
半角转全角: