how to match u'\uff00' - u'\uff0f' in re module?

2006-07-10 Thread yichao.zhang
I'm trying to match the characters from u'\uff00' to u'\uff0f'.
the code below and get a TypeError.
p = re.compile(u'\uff00'-u'\uff0f')
Traceback (most recent call last):
  File interactive input, line 1, in ?
TypeError: unsupported operand type(s) for -: 'unicode' and 'unicode'


so re module does NOT support this operation
however, is there any alternative way to solve my problem?

Any comments/suggestions much appreciated!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to match u'\uff00' - u'\uff0f' in re module?

2006-07-10 Thread yichao.zhang
MacDonald
Thanks!

John
Now I know how silly a question that is !
However I'll be not so silly thanks to your help !
I'll follow your suggestions! That's very nice.

-- 
http://mail.python.org/mailman/listinfo/python-list


writing some lines after reading goes wrong on windows?

2006-04-27 Thread yichao.zhang
Hi all
I can not write anything if I have read something.
the code as:


Python 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)]
on win32
IDLE 1.1.3
 a=open('d:\\a','r+')
 a
open file 'd:\a', mode 'r+' at 0x00A147B8
 a.read()
'11\n22\n33\n'
 a.seek(0)
 a.read(1)
'1'
 a.write(a)
 a.seek(0)
 a.read()
'11\n22\n33\n'   # it fails to write after reading

 a.seek(0)
 a.write(a)
 a.seek(0)
 a.read()
'a1\n22\n33\n'  # it writes fine at the beginning of
the file


it fails to write a. but on my debian box, it works fine.
the code on debian as:
 Python 2.3.5 (#2, Sep  4 2005, 22:01:42)
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
Type help, copyright, credits or license for more information.
 a=open('/a','r+')
 a
open file '/a', mode 'r+' at 0x4019dd60
 a.read()
'11\n22\n33\n'
 a.seek(0)
 a.read(1)
'1'
 a.write(a)
 a.seek(0)
 a.read()
'1a\n22\n33\n'
 

What's wrong here? is this a bug on windows platform.

-- 
http://mail.python.org/mailman/listinfo/python-list