Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> s = "234" # "2" is a double-byte integer
- >>> if u"2" in s:
- print "y"
- >>> if u"2" in s:
- print "y"
- y
- >>> print s[0]
- >>> print s[:2]
- 2
- >>> print s[:3]
- 23
- text = incoming_bytes.decode("shift_jis")
- # ... do stuff ...
- outgoing_bytes = text.encode("shift_jis")
- >>> import re
- >>> s = u"234"
- >>> digit = re.compile(r"d", re.U)
- >>> for d in re.findall(digit, s):
- ... print d,
- ...
- 2 3 4
- >>> wdigit = re.compile(u"[0-9]+")
- >>> for wd in re.findall(wdigit, s):
- ... print wd,
- ...
- 2
- ord("2")
- 65298
- def convert_two_byte_numbers(character: str):
- if ord(character) in range(65296, 65306):
- return chr(ord(character) - 65248)
- else:
- return character
Add Comment
Please, Sign In to add comment