Re: get quote enclosed field in a line

2008-04-17 Thread Penny Y.
Hello, I don't know Python's RE very well. But using Perl's RE you can get it. > cat t1.pl $x=qq{189.139.109.235 - - [07/Apr/2008:00:00:16 -0400] "GET /Periodic_dosage_dir/lacru/manara.html HTTP/1.1" 200 1933 xahlee.org "http://xahlee.org/Periodic_dosage_dir/lacru/manara2.html"; "Mozilla/5.0 (Wi

about a head line

2008-04-17 Thread Penny Y.
I saw some scripts have a line at its begin: # encoding:gb2312 what's this? Why need it? thanks. -- http://mail.python.org/mailman/listinfo/python-list

a name error

2008-04-14 Thread Penny Y.
Hello, I run this small script: import urllib2,sys try: r=urllib2.urlopen("http://un-know-n.com/";) except URLError,e: print str(e) sys.exit(1) print r.info() But got the errors: Traceback (most recent call last): File "t1.py", line 4, in ? except URLError,e: NameError: name

答复: 有中国人乎?

2008-04-14 Thread Penny Y.
-邮件原件- 发件人: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 代表 Steve Holden 发送时间: 2008年4月15日 2:17 收件人: python-list@python.org 主题: Re: 有中国人乎? >Since what I entered in English was something like "Yes, Python has a >future. But it will take some study". Perhaps you can tell me whether >your

答复: Java or C++?

2008-04-14 Thread Penny Y.
Javascript is different from Java at all. Why not Perl? Perl is a functional language, that will show you another way of programming. Also C is good, will teach you some system level knowledge. :) -邮件原件- 发件人: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 代表 Marco Mariani 发送时间: 2008年4月14日 16:

答复: 答复: how to remove \n in the list

2008-04-14 Thread Penny Y.
that's right. got it thanks. -邮件原件- 发件人: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 代表 Eric Brunel 发送时间: 2008年4月14日 16:17 收件人: python-list@python.org 主题: Re: 答复: how to remove \n in the list (please avoid top-posting... corrected) On Mon, 14 Apr 2008 09:08:06 +0200, Penny Y. &l

答复: how to remove \n in the list

2008-04-14 Thread Penny Y.
> lines[:] = [line.rstrip('\n') for line in lines] why not just: lines = [line.rstrip('\n') for line in lines] what's the difference between lines[:] and lines here? Thanks. -邮件原件- 发件人: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 代表 Gabriel Genellina 发送时间: 2008年4月14日 12:59 收件人: python-

Re: 有中国人乎?

2008-04-13 Thread Penny Y.
Steve Holden 写道: > 但学会从未是立即, 和将需要一点时间。 > What do you mean? If I understand you correctly, maybe it should be, 学习python不可一日而成,需要循序渐进. Am I right? -- http://mail.python.org/mailman/listinfo/python-list

mod_python

2008-04-13 Thread Penny Y.
Hello, I want to rewrite a request url under apache2.0 based on its special header, like, the "Accept-Encoding:" one. With C I think I can do it, but since I get begin with python,so I ask that can I do it under mod_python? what's the guide? Thanks. -- http://mail.python.org/mailman/listinfo/

Host: header

2008-04-13 Thread Penny Y.
Hello, I have a problem with a request url,for example, I have the code below, import httplib try: conn = httplib.HTTPConnection("192.168.1.1") conn.request("GET", "/") r1 = conn.getresponse() if r1.status == 200: result = 0 except Exception: result = -1 but the ser

about the ';'

2008-04-13 Thread Penny Y.
I saw many python programmers add a ';' at the end of each line. As good style, should or should not we do coding with that? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: 有中国人乎?

2008-04-13 Thread Penny Y.
[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. But if you are playing in computer programming, it's valuable for you to