Re: Why all the __double_underscored_vars__?

2009-08-08 Thread Yongjian Xu
These "special" methods are not meant to be used or known to beginners. They aren't even meant to be called directly (in most cases). They are either operator overloading methods or behavior customization methods. In my opinion, in the meta programming realm. Should probably in advanced topic or so

Re: POpen - Wait For Process To Complete

2007-07-03 Thread Yongjian Xu
That's by using the P3/P4 classes not the function. the function does not provide wait() call, it simply does it for you by default. Jim On 7/3/07, Robert Rawlins - Think Blue <[EMAIL PROTECTED]> wrote: Hello guys, Quite a simple one I'm hoping. I've got a process that I run using popen whi

Re: Converting Diff Output to XML?

2007-06-27 Thread Yongjian Xu
gnosis has a converter for ASCII file to xml file, its called txt2dw.py. give it a try. -- Jim On 6/26/07, Debajit Adhikary <[EMAIL PROTECTED]> wrote: What would be the best way to convert the regular (unix) diff output into XML? Are there any libraries at all which might help? -- http://mail

Re: Get the current date, python 2.2

2007-06-15 Thread Yongjian Xu
time.strftime('%Y-%m-%d', time.localtime()) gives you just the date format. Jim On 6/15/07, nano <[EMAIL PROTECTED]> wrote: Using python 2.2 what is the simplest way to get the current date value? I have looked in so many places. The question is often asked and the usual response indicates how

Re: Forgetting an import

2007-06-12 Thread Yongjian Xu
ipython supports deepreload which will recompile the bytecode from the file no matter what. You can set the option up in ipython and use it. It requires no exit to the current env. Jim On 6/12/07, Larry Bates <[EMAIL PROTECTED]> wrote: HMS Surprise wrote: > I imported a set of functions from a

Re: url encode

2007-06-05 Thread Yongjian Xu
you can take a look urlib.quote or quote_plus methods. Jim On 6/5/07, Lee Jones <[EMAIL PROTECTED]> wrote: Hello, I am trying to urlencode a string. In python the only thing I can see is the urllib.urlencode(). But this takes a dictionary, and returns "key=value", which is not what I wan

Re: Sending cookies with python. When download with python

2007-06-05 Thread Yongjian Xu
yes. urllib2 has Request class that compose html headers (dict object) into a request object where you can put Cookie: header into it. Also, there are a few Cookie related modules you can use too. An example using urllib2 can be something like this: def myrequest(url): req = urllib2.Request(ur

Re: example: 40286 -> 68204

2007-06-03 Thread Yongjian Xu
Don't think there is one in builtin for that and might have to convert str <-> int to do that too, such as int(str(i)[::-1]) ... Jim On 6/3/07, Shihpin <[EMAIL PROTECTED]> wrote: Hi all, Is there a fuction that reverse the digits of a number? Many thanks, Shihpin Lin -- http://mail.python.