I have to check strings in Japanese that are encoded in double-byte characters (naturally the files aren't in Unicode and I have to keep them in Shift-JIS). Many of these strings contain digits that are also double byte characters, (123456789) instead of standard single-byte digits (0-9). As such, the usual methods of searching for digits won't work (using [0-9] in regex, or \d for example).
The only way I've found to make it work is to create a tuple and iterate over the tuple in a string to look for a match, but is there a more effective way of doing this?
This is an example of the output I get when searching for double byte numbers:
>>> 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
Any advice would be greatly appreciated!