re and locale/unicode

2010-09-20 Thread Jerry Fleming
Hi, Having the following python code: import locale import re locale.setlocale(locale.LC_ALL, 'zh_CN.utf8') re.findall('(?uL)\s+', u'\u2001\u3000\x20', re.U|re.L) re.findall('\s+', u'\u2001\u3000\x20', re.U|re.L) re.findall('(?uL)\s+', u'\u2001\u3000\x20') I was wondering why doesn't it find

sqlalchemy: how to define association object with declarative style?

2010-09-07 Thread Jerry Fleming
Hi, I want to define the relationship for my users and their groups with declarative style (so that the relating model can inherit Timestamp mixin and Tablename mixin): class User(DeclarativeBase, Tablename, TimestampMixin): '''User avatar is named after its id. A user may be a student or

Re: 有中国人乎?

2008-04-14 Thread Jerry Fleming
Penny Y. wrote: > [EMAIL PROTECTED] 写道: >> Python这种语言有前途吗?在下想学他一学. > > hehe, so humorous you are! > Yes I think python has good future. > But it depends on what you use it to do. > If you're a singer, a financier, a historian etc, you don't need python. A singer uses his/here throat; a financier u

do 'os.path' include 'os' for us?

2008-03-27 Thread Jerry Fleming
Hi, I wrote a python script to list files in a directory but somehow did it wrongly by importing os.path instead of os. To my astonishment, it works just as charm: #!/usr/bin/python import os.path for file in os.listdir('/root/'): print file I was wondering why? os.path doesn't contain

Re: ctypes in python failed to honor c_int

2008-03-18 Thread Jerry Fleming
Gabriel Genellina wrote: > On 18 mar, 04:12, Jerry Fleming <[EMAIL PROTECTED]> wrote: >> Gabriel Genellina wrote: >>> On 17 mar, 23:57, Jerry Fleming <[EMAIL PROTECTED]> wrote: >>>> I have a binary file written with c structures. Each record contains a >

Re: ctypes in python failed to honor c_int

2008-03-17 Thread Jerry Fleming
Gabriel Genellina wrote: > On 17 mar, 23:57, Jerry Fleming <[EMAIL PROTECTED]> wrote: > >> I have a binary file written with c structures. Each record contains a >> null-terminated string followed by two 4-bytes integers. I wrote a small >> segment of python code

ctypes in python failed to honor c_int

2008-03-17 Thread Jerry Fleming
Hi, I have a binary file written with c structures. Each record contains a null-terminated string followed by two 4-bytes integers. I wrote a small segment of python code to parse this file in this way: [coe] #!/usr/bin/python from ctypes import * class Entry(Structure): _fields_ = ('w

Re: Python editor

2006-08-28 Thread Jerry Fleming
Larry Bates wrote: > Jason Jiang wrote: >> Hi, >> >> Could someone recommend a good Python editor? Thanks. >> >> Jason >> >> >> > For just getting started use Idle that comes with Python. > If you are already a user or if you are looking for a more > powerful solution you can use Eclipse (with Pyt

python game with curses

2006-04-28 Thread Jerry Fleming
Hi, I have wrote a game with python curses. The problem is that I want to confirm before quitting, while my implementation doesn't seem to work. Anyone can help me? [code] #!/usr/bin/python # # Brick & Ball in Python # by Jerry Fleming <[EMAIL PROTECTED]> # # This is a small ga