Serialization, save type information in file and restore them

2010-06-18 Thread Timothy Wu
Hi, I created a class that's able to manipulate tabulated data. I want to be able to dump the bulk of the data and other attributes as a tab-delimited text. I have trouble saving/restoring type information in the file. For example, some attributes are int, others may be float, etc. So I want to st

xml.sax problem

2008-03-23 Thread Timothy Wu
Hi, I have created a very, very simple parser for an XML. class FindGoXML2(ContentHandler): def characters(self, content): print content I have made it simple because I want to debug. This prints out any content enclosed by tags (right?). The XML is publicly available here: http://e

Re: xml sax

2008-03-19 Thread Timothy Wu
Oh right, why didn't I think of that. =) Many thanks. Timothy On Thu, Mar 20, 2008 at 1:45 AM, Robert Bossy <[EMAIL PROTECTED]> wrote: > Timothy Wu wrote: > > Hi, > > > > I am using xml.sax.handler.ContentHandler to parse some simple xml. > > > > I

xml sax

2008-03-19 Thread Timothy Wu
Hi, I am using xml.sax.handler.ContentHandler to parse some simple xml. I want to detect be able to parse the content of this tag embedded in the XML. 174 Is the proper way of doing so involving finding the "Id" tag from startElement(), setting flag when seeing one, and in characters(), when s

Gdmodule

2006-12-23 Thread Timothy Wu
Hi, Is Gdmodule used much at all in the Python community or are there alternative packages more suitable for the purpose? I seem to find documentation for Gdmodule ( http://newcenturycomputers.net/projects/gd-ref.html) to require prior experience with the GD library in another language. Or at lea

Re: Generator question

2006-11-26 Thread Timothy Wu
On 11/26/06, Robert Kern <[EMAIL PROTECTED]> wrote: The only thing that the last line does is *create* a new generator object. You need to actually iterate over it and yield its values. E.g. In [2]: def test_gen(x): ...: yield x ...: x -= 1 ...: if x != 0: ...:

Generator question

2006-11-26 Thread Timothy Wu
Hi, Using generator recursively is not doing what I expect: def test_gen(x): yield x x = x - 1 if x != 0: test_gen(x) for item in test_gen(3): print item This gives me a single number 3 and not printing 2 and 1 as I would expect. What is wrong?? Timothy -- http://mail.py

Re: urllib problem (maybe bugs?)

2005-03-31 Thread Timothy Wu
On Wed, 30 Mar 2005 18:25:56 +0200, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Timothy Wu wrote: > > > After I've done that it works fine for small SEQ values. Then, when I > > try to send large amount of data (1.4MB), it fails miserably with > > AttributeEr

urllib problem (maybe bugs?)

2005-03-30 Thread Timothy Wu
Hi, I'm trying to fill the form on page http://www.cbs.dtu.dk/services/TMHMM/ using urllib. There are two peculiarities. First of all, I am filling in incorrect key/value pairs in the parameters on purpose because that's the only way I can get it to work.. For "version" I am suppose to leave it u