Is Python string immutable?

2005-11-30 Thread could ildg
In java and C# String is immutable, str=str+"some more" will return a new string and leave some gargabe. so in java and C# if there are some frequent string operation, StringBuilder/StringBuffer is recommanded.   Will string operation in python also leave some garbage? I implemented a net-spider i

Re: How could I ask Thread B to call B().Method() from inside Thread A's run?

2005-11-30 Thread could ildg
Thank you.On 30 Nov 2005 09:30:23 -0800, NavyJay <[EMAIL PROTECTED]> wrote: I agree with jmj's solution, you would want to send a signal of somesort to Thread B from A when some event occurs in A.  A queue is oneway to do it, but keep in mind that there are numerous ways tocommunicate between threa

How could I ask Thread B to call B().Method() from inside Thread A's run?

2005-11-30 Thread could ildg
I have 2 thead instances, A and B, In A's run method, if I call B.Method(), it will be executed in thead A, but I want B.Method() to be executed in B's thread. That's to say, I want to tell Thead B to do B's stuff in B's thread, kinda like PostMessage in win32. Can I do it in python? How? Thank you

Re: How to paste python code on wordpress?

2005-11-21 Thread could ildg
Thank you very much Dan.I settle the problem according to you tips.On 11/22/05, Dan Lowe <[EMAIL PROTECTED] > wrote:On Nov 22, 2005, at 12:30 AM, could ildg wrote:> Thank you~ > It works!> but how can paste "<" and ">", please?> these 2 symbols will also

Re: How to paste python code on wordpress?

2005-11-21 Thread could ildg
Thank you~It works!but how can paste "<" and ">", please?these 2 symbols will also confuse wordpress and I can't publish what I want.On 11/22/05, Dan Lowe <[EMAIL PROTECTED]> wrote: On Nov 21, 2005, at 8:17 PM, could ildg wrote:> Wordpress.com blog will e

How to paste python code on wordpress?

2005-11-21 Thread could ildg
Wordpress.com blog will eat up the spaces before a line, just as it will trim every line of my article. So I can't paste python code indentedly. Does any one use wordpress blog here? Please tell me how to leave the sapces as they are when publishing ariticles on the blog, Thank you. -- http://mail

Which blog do you use?

2005-11-11 Thread could ildg
I want to to get a free blog sapce these days, which has category for my posts. What blog do you use? I'll apprecaite your recommendation. -- http://mail.python.org/mailman/listinfo/python-list

Re: hello, I want to change n bytes of a binary file

2005-11-02 Thread could ildg
Thanks to Fredrik Lundh,It works~On 11/2/05, Fredrik Lundh <[EMAIL PROTECTED] > wrote:"could ildg" wrote:> > so how can I do the binary stuff? >> 8-bit strings contain bytes.>> > I want a encrypt function like below:> > def encrypt(filename,n):>&

Re: hello, I want to change n bytes of a binary file

2005-11-01 Thread could ildg
On 11/1/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: "could ildg" wrote:> I want to encrypt a very large birany file,> but if to change the whole file, it will take very long time,> so I just want to change n(n is an int) bytes of the file. > but when I turned to the

hello, I want to change n bytes of a binary file

2005-11-01 Thread could ildg
I want to encrypt a very large birany file,but if to change the whole file, it will take very long time,so I just want to change n(n is an int) bytes of the file.but when I turned to the file I/O of python, I found that file object can only read and write strings, so how can I do the binary stuff?I

Re: py2exe 0.6.3 released

2005-10-07 Thread could ildg
Nice job~Thank you.On 10/7/05, Jimmy Retzlaff <[EMAIL PROTECTED]> wrote: py2exe 0.6.3 released=py2exe is a Python distutils extension which converts Python scriptsinto executable Windows programs, able to run without requiring aPython installation. Console and Windows (GUI) appl

Re: Will python never intend to support private, protected and public?

2005-09-29 Thread could ildg
Thank you skip.Encapsulation or information hiding or whatever, that's what I'm looking forward to.On 9/30/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:>> **Encapsulation** is one of the 3 basic characteristics of OOP. This isn't an encapsulation issue.  From the first hit on Google for the

Re: New Python chess module

2005-09-29 Thread could ildg
Very good~On 9/29/05, Will McGugan <[EMAIL PROTECTED]> wrote: Hi folks,I've written a Python chess module that does the following.* Reads / Writes PGN files* Write FEN files* Validates moves* Lists legal moves* Detects check / mate / stalemate / 50 move rule / threefold repetition Its still rough a

Re: Will python never intend to support private, protected and public?

2005-09-29 Thread could ildg
**Encapsulation** is one of the 3 basic characteristics of OOP.When I firstly turned to python, it was my first script language.That time I found that python has not real private properties,I felt weird. If an oop language can't encapsulate something I want, is it really an oop language? I asked my

Will python never intend to support private, protected and public?

2005-09-28 Thread could ildg
Python is wonderful except that it has no real private and protected properties and methods.Every py object has dict so that you can easily find what fields and methods an obj has,this is very convenient, but because of this, py is very hard to support real private and protected?If private and pro

How can I find all the dependencies of a py?

2005-09-14 Thread could ildg
when  I run a.py, it uses b.py,c.py and a.py uses x.py,y.py How could I find all the modules that a.py and all of its imported modules? Is there any built in functions or any tools to do this? Thank you~, I really want to know it. -- http://mail.python.org/mailman/listinfo/python-list

Re: SQL SERVER : how to access it from Python

2005-09-13 Thread could ildg
Use ADO.If you ever used vb, using ado in py is just the same.If you don't know about ado, you can refer to this url:http://www.mayukhbose.com/python/ado/what-is-ado.php On 9/14/05, Chavez Gutierrez, Freddy <[EMAIL PROTECTED]> wrote: Hi all. I like to access a SQL SERVER from a Python 2.4

Re: [Jython-users] ANN: PyDev 0.9.8.1 released

2005-09-06 Thread could ildg
Thanks. pydev is so alive.On 9/7/05, Fabio Zadrozny <[EMAIL PROTECTED]> wrote: Hi All,PyDev - Python IDE (Python Development Enviroment for Eclipse) version0.9.8.1 has been released.Check the homepage (http://pydev.sourceforge.net/ ) for more details.Details for Release: 0.9.8.1Major highlights:---

Re: [Jython-users] Re: [Jython-dev] Parsing grammar for jython available (compatible with python 2.4)

2005-08-29 Thread could ildg
thanks. pydev is very nice, I like it. But sometimes the code completion will not work.On 8/30/05, Frank Wierzbicki <[EMAIL PROTECTED]> wrote: The code, as well as the files for javacc and asdl (both were changed) are available in the pydev cvs at sourceforge, in theorg.python.pydev.parser module

Re: How can I exclude a word by using re?

2005-08-16 Thread could ildg
Thanks for all of you~ I made it. Pyparsing is really nice. On 16 Aug 2005 11:33:48 -0700, Paul McGuire <[EMAIL PROTECTED]> wrote: > I just reviewed what the re "\s" signifies: whitespace. This is easy, > pyparsing ignores all intervening whitespace by default. So mp3Entry > simplfies to: > > m

Re: How can I exclude a word by using re?

2005-08-15 Thread could ildg
Thank you, you code using pyparsing works very well. Now I got the "number" and the "url". But I still want to get the "name". I'll turn to pyparsing and see how to get the "name" from the html. But I hope you can enlighten me for one more time since I'm not farmiliar with the pyparsing module. O

Re: How can I exclude a word by using re?

2005-08-15 Thread could ildg
in this html, so this must be done by using re. And I can't use any of your idea because what I want I deal with is a very complicated html, not just a single line of word. I can copy part of the html up to here but it's kinda too lengthy. On 8/15/05, John Machin <[EMAIL PROTECTED]>

Re: How can I exclude a word by using re?

2005-08-14 Thread could ildg
Thank you. But what should I do if there are more than one hello and I only want to extract what's before the first "hello". For example, the raw string is "hi, how are you? hello I'm fine, thank you hello. that's it hello", I want to extract all the stuff before the first hello? On 14 Aug 2005 08

How can I exclude a word by using re?

2005-08-14 Thread could ildg
In re, the punctuation "^" can exclude a single character, but I want to exclude a whole word now. for example I have a string "hi, how are you. hello", I want to extract all the part before the world "hello", I can't use ".*[^hello]" because "^" only exclude single char "h" or "e" or "l" or "o". W

Re: What does the word "quiet" mean in this paragraph?

2005-08-14 Thread could ildg
Thank you very much. I am not a native English speeker so I have problem when understanding this sentense. Now I know that the word "quiet" is an adjective and I'm totally catch it. Thank you~ On 8/14/05, Peter Decker <[EMAIL PROTECTED]> wrote: > On 8/14/05, could ildg &

What does the word "quiet" mean in this paragraph?

2005-08-14 Thread could ildg
The paragraph is as below, I mark the word quiet with *** ***. ___ One problem with distributed applications is that if no data arrives over a long period of time, you need to wonder why. On one hand, it could be that the other program just hasn't had any information

Re: Python Challenge on BBC

2005-08-11 Thread could ildg
But when I can't find a way for a long time, I'll be upset. On 8/12/05, Jeff Schwab <[EMAIL PROTECTED]> wrote: > Magnus Lie Hetland wrote: > > Just saw this on the BBC World program Click Online: > > > > > > http://bbcworld.com/content/template_clickonline.asp?pageid=665&co_pageid=6 > > > > I m

Re: Python Project (sigh with Java)

2005-08-08 Thread could ildg
But the function is also too limited. What I want to do is to run much of my py scripts in jython as good as possible. On 8/9/05, Ramza Brown <[EMAIL PROTECTED]> wrote: > could ildg wrote: > > Good job~ > > I also like both java and py so I always focus on jython, > &g

Re: Python Project (sigh with Java)

2005-08-08 Thread could ildg
Good job~ I also like both java and py so I always focus on jython, but now it's being moved forward kinda slow. I'm looking forward to jython 2.4. You're right, swing is great. wxpy is also wonderfu but it's so lack of docs. I mainly work on windows so I use p4d(python for delphi), I use delphi f

Re: How to determine that if a folder is empty?

2005-08-08 Thread could ildg
On 8/8/05, Peter Hansen <[EMAIL PROTECTED]> wrote: > could ildg wrote: > > I want to check if a folder named "foldername" is empty. > > I use os.listdir(foldername)==[] to do this, > > but it will be very slow if the folder has a lot of sub-files. >

Re: How to determine that if a folder is empty?

2005-08-07 Thread could ildg
Thank you . so you mean that this is not platform-independent? On 8/8/05, Neil Hodgson <[EMAIL PROTECTED]> wrote: > could ildg: > > > I want to check if a folder named "foldername" is empty. > > I use os.listdir(foldername)==[] to do this, > > but it will

How to determine that if a folder is empty?

2005-08-07 Thread could ildg
I want to check if a folder named "foldername" is empty. I use os.listdir(foldername)==[] to do this, but it will be very slow if the folder has a lot of sub-files. Is there any efficient ways to do this? Thanks~ -- http://mail.python.org/mailman/listinfo/python-list

Re: IronPython 0.9 Released

2005-08-05 Thread could ildg
Why is iron python runs so fast but jython runs so slow while C# and java seem very much the same? On 8/5/05, EP <[EMAIL PROTECTED]> wrote: > Oops. Nevermind. > > [like the old Saturday Night Live] > > > > > Original Message > > From: "EP" <[EMAIL PROTECTED]> > > To: p

Re: Does pyparsing support UNICODE strings?

2005-08-04 Thread could ildg
;) > alphas = u''.join(unichr(x) for x in xrange(0x386, 0x3ce)) > greet = Word(alphas) + u',' + Word(alphas) + u'!' > greeting = greet.parseString(text) > print greeting > > > my system default is cp936, Simp Chinese. > > On Thu, 4 Aug 2005

Re: Does pyparsing support UNICODE strings?

2005-08-04 Thread could ildg
loc,tokens = self.parseImpl( instring, loc, doActions ) > File "C:\Python24\Lib\site-packages\pyparsing.py", line 873, in parseImpl > raise exc > pyparsing.ParseException: Expected "," (at char 5), (line:1, col:6) > On Thu, 4 Aug 2005 17:24:23 +0800 > could i

Re: Does pyparsing support UNICODE strings?

2005-08-04 Thread could ildg
OK, I make it. It's right, it can work fine with unicode. pyparsing is great. Thanks. On 8/4/05, could ildg <[EMAIL PROTECTED]> wrote: > I want to parse some Chinese words. > It seems that pyparsing doesn't work for me. > Thank you. > I have to use re directly, alt

Re: Does pyparsing support UNICODE strings?

2005-08-04 Thread could ildg
I want to parse some Chinese words. It seems that pyparsing doesn't work for me. Thank you. I have to use re directly, although it's harder, but it'll always work. On 8/4/05, Robert Kern <[EMAIL PROTECTED]> wrote: > could ildg wrote: > > pyparsing is very conveni

Does pyparsing support UNICODE strings?

2005-08-04 Thread could ildg
pyparsing is very convenient to use. But I want to find some a py tool to parse non-English strings. Does pyparsing support UNICODE strings? If not, can someone tell me what py tool can do it? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python s60 Contact DB

2005-07-19 Thread could ildg
You should raise this question at Nokia python for series60 forum, I'm sure you can the answer there. http://discussion.forum.nokia.com/forum/forumdisplay.php?s=85e4c1acee330fddde6b47a7b2feae73&forumid=102 On 19 Jul 2005 06:47:10 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, i hope th

What does "::" mean?

2005-07-19 Thread could ildg
I know that ":" can do slice works. But I saw "::" today and it puzzled me much, I can't find it in the python doc, so I raise this question here. The code is as below: -- Jython 2.2a1 on java1.5.0_03 (JIT: null) Type "copyright", "credits" or

Re: Python s60

2005-07-18 Thread could ildg
you can reference http://www.bigbold.com/snippets/tags/series60?page=2 On 18 Jul 2005 03:32:01 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, I have looked around for any type of example of script that claims > to read the contacts database from an s60 phone, but i cant figure how > to

Re: How can I import a py script by its absolute path name?

2005-07-15 Thread could ildg
path you just added. > > -Chris > On Thu, Jul 14, 2005 at 02:52:31PM +0300, Edvard Majakari wrote: > > could ildg <[EMAIL PROTECTED]> writes: > > > > > I want to import c:\xxx\yyy\zzz.py into my programme, > > > What should I do? > > > Thank y

Re: How can I import a py script by its absolute path name?

2005-07-14 Thread could ildg
You are quite right~ On 7/15/05, Peter Hansen <[EMAIL PROTECTED]> wrote: > Jesse Noller wrote: > > A question in a similiar vein: > > > > I have appended 2 different directories to my path (viaY > > sys.path.append) now - without knowing the names of the files in those > > directories, I want to f

Re: How can I import a py script by its absolute path name?

2005-07-14 Thread could ildg
for f in os.listdir(os.path.abspath(libdir)): module_name = f.strip('.py') __import__(module_name, globals(), locals(), []) On 7/14/05, Jesse Noller <[EMAIL PROTECTED]> wrote: > A question in a similiar vein: > > I have appended 2 different directories to my path (via > sys.path.append) now

How can I import a py script by its absolute path name?

2005-07-14 Thread could ildg
I want to import c:\xxx\yyy\zzz.py into my programme, What should I do? Thank you~ -- http://mail.python.org/mailman/listinfo/python-list

Re: It seems that ZipFile().write() can only write files, how can empty directories be put into it?

2005-07-02 Thread could ildg
Thank you. On 7/1/05, Jeff Epler <[EMAIL PROTECTED]> wrote: > This has been discussed before. One thread I found was > http://mail.python.org/pipermail/python-list/2003-June/170526.html > The advice in that message might work for you. > > Jeff > > > -- http://mail.python.org/mailman/listinfo/

It seems that ZipFile().write() can only write files, how can empty directories be put into it?

2005-06-30 Thread could ildg
I want to "create" a empty folder in a zipfile, Can ZipFile do it? If not, any other approachs? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to compare two directories?

2005-06-30 Thread could ildg
Thank you~ I get it. On 6/30/05, Michael Hoffman <[EMAIL PROTECTED]> wrote: > could ildg wrote: > > I found dircmp compare only the direct dirs and files, > > and it will not do anything to the sub-directories. > > The documentation for dircmp.report_full_c

Re: How to compare two directories?

2005-06-30 Thread could ildg
I found dircmp compare only the direct dirs and files, and it will not do anything to the sub-directories. On 6/29/05, Michael Hoffman <[EMAIL PROTECTED]> wrote: > could ildg wrote: > > I want to compare 2 directories, > > and find If all of theire sub-folders and fi

How to compare two directories?

2005-06-28 Thread could ildg
I want to compare 2 directories, and find If all of theire sub-folders and files and sub-files are identical. If not the same, I want know which files or folders are not the same. I know filecmp moudle has cmpfiles function and a class named dircmp, they may help, but I wonder if there is a ready-t

Re: How to compress a folder and all of its sub directories and files into a zip file?

2005-06-28 Thread could ildg
Thanks to Brian van den Broek , I've just reached the doc, too. I'm now very clear. On 6/28/05, Brian van den Broek <[EMAIL PROTECTED]> wrote: > could ildg said unto the world upon 28/06/2005 03:29: > > but the file is just stored, > > and not compressed. > &g

Re: How to compress a folder and all of its sub directories and files into a zip file?

2005-06-28 Thread could ildg
but the file is just stored, and not compressed. On 6/28/05, could ildg <[EMAIL PROTECTED]> wrote: > Thank you, > it works~~ > > On 6/29/05, Peter Szinek <[EMAIL PROTECTED]> wrote: > > Hi, > > > > What about this: > > > > import o

Re: How to compress a folder and all of its sub directories and files into a zip file?

2005-06-28 Thread could ildg
'.'): > for fileName in files: > zip.write(join(root,fileName)) > zip.close() > > Maybe it zips also the myzipfile.zip ;-) > Probably this is not needed, so an additional test (something like > fileName != 'myfile.zip' would be needed. > >

How to compress a folder and all of its sub directories and files into a zip file?

2005-06-27 Thread could ildg
I want to compress a folder and all of its sub files including empty folders into a zip file. what's the pythonic way to do this? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

Re: delphi to python converter

2005-06-27 Thread could ildg
The only thing you can do at present is to convert by yourself with hand, recode them line by line. On 6/27/05, Thys Meintjes <[EMAIL PROTECTED]> wrote: > Greets, > > I have need of a Delphi/pascal to python converter. Googling didn't > suggest any obvious leads so I'm trying here... > > Thanks

Is pyunit still usable?

2005-05-30 Thread could ildg
I want to know something about unittest these days, and since I'm learning python, I want to touch it through python. But when I found the newest pyunit is even so old, I wonder if it is still usable for current python version 2.4. Will you please tell me? Thank you. What are the advantages and di

A newbie metaclass question

2005-05-22 Thread could ildg
When I try to learn metaclass of python by article at this place: http://www.python.org/2.2/descrintro.html#metaclasses, I changed the autosuper example a little as below: class autosuper(type): def __init__(cls,name,bases,dict): super(autosuper,cls).__init__(name,bases,dict) s

Re: ANN: new release of RUR-PLE available

2005-05-21 Thread could ildg
It's very interestring, I like it. On 5/20/05, André Roberge <[EMAIL PROTECTED]> wrote: > Michael Hoffman wrote: > > André Roberge wrote: > > > >>Version 0.8.6a is now available. > > > > > > You might see a bit more interest if you briefly explain what RUR-PLE > > is, and where to find it. > Oops..

Re: What's the use of changing func_name?

2005-05-19 Thread could ildg
obert Kern <[EMAIL PROTECTED]> wrote: > could ildg wrote: > > Thank you for your help. > > I know the function g is changed after setting the func_name. > > But I still can't call funciton g by using f(), when I try to do > > this, error will occur: &

Re: How to learn OO of python?

2005-05-19 Thread could ildg
Steven Bethard: Thank you so much! Your answer is very very helpful~ On 5/19/05, Steven Bethard <[EMAIL PROTECTED]> wrote: > could ildg wrote: > > I think decorator is a function which return a function, is this right? > > e.g. The decorator below if from > > http://w

Re: What's the use of changing func_name?

2005-05-18 Thread could ildg
File "", line 1, in ? NameError: name 'f' is not defined Since the name of g is changed into f, why can't I call it by using f()? Should I call it using f through other ways? Please tell me. Thanks~ On 5/19/05, Robert Kern <[EMAIL PROTECTED]> wrote: > could ildg

What's the use of changing func_name?

2005-05-18 Thread could ildg
def a(func): def _inner(*args, **kwds): print "decorating..." return func(*args, **kwds) _inner.func_name = func.func_name -->when I delete this line, the rusult is the same. why? return _inner @a def g(*args): for x in args: print x print "this is in fu

Re: How to learn OO of python?

2005-05-18 Thread could ildg
r function which takes only one argument, the function to decorate. Is this right? On 5/18/05, Harlin Seritt <[EMAIL PROTECTED]> wrote: > could ildg wrote: > > I have learned python for over a month. > > I heard that it was very easy to learn, but when I tried to know OO >

How to learn OO of python?

2005-05-18 Thread could ildg
I have learned python for over a month. I heard that it was very easy to learn, but when I tried to know OO of python, I found it really weird, some expressions seem very hard to understand, and I can't find enough doc to know any more about it. So, I wonder how did you master python? And where to

Re: Found python for delphi new web site

2005-05-06 Thread could ildg
I haven't compile the PyScripter IDE project yet. Does it support code-insight? On 6 May 2005 22:28:59 -0700, James <[EMAIL PROTECTED]> wrote: > It has been around for a while now. But I am glad I visited it again. > The new PyScripter IDE is great. They should really announce new > software like

Found python for delphi new web site

2005-05-06 Thread could ildg
http://mmm-experts.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: How to write this regular expression?

2005-05-04 Thread could ildg
Sorry to Jeremy, I send my email derectly to your mailbox just now. Group is very useful. On 5/5/05, Jeremy Bowers <[EMAIL PROTECTED]> wrote: > On Thu, 05 May 2005 09:30:21 +0800, could ildg wrote: > > Jeremy Bowers wrote: > >> Python 2.3.5 (#1, Mar 3 2005, 17:32:12) [

Re: How to write this regular expression?

2005-05-04 Thread could ildg
On 5/5/05, Jeremy Bowers <[EMAIL PROTECTED]> wrote: > On Wed, 04 May 2005 20:24:51 +0800, could ildg wrote: > > > Thank you. > > > > I just learned how to use re, so I want to find a way to settle it by > > using re. I know that split it into pieces will do

Re: How to write this regular expression?

2005-05-04 Thread could ildg
Thank you. I just learned how to use re, so I want to find a way to settle it by using re. I know that split it into pieces will do it quickly. On 5/4/05, Peter Hansen <[EMAIL PROTECTED]> wrote: > could ildg wrote: > > I need a regular expression to check if a string matches it.

Re: How to write this regular expression?

2005-05-04 Thread could ildg
I can tell you that this is not any homework at all, I think it by myself. I like this maillist, it helped me a lot. but some guys as you look weird. On 4 May 2005 10:25:20 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: > Op 2005-05-04, could ildg schreef <[EMAIL PROTECTED]>: >

Re: How to write this regular expression?

2005-05-04 Thread could ildg
Does it matter whether it is a homework? Why do you look down upon homework? Everyone can do his homework well without any problems in your logic? It's a problem I met. I tried a lot and I can't work it out, so I came here for help. I saw someone complained that a question is too lengthy, and I saw

How to write this regular expression?

2005-05-03 Thread could ildg
I need a regular expression to check if a string matches it. The string consists of one to there parts, each parts is a underline followed by a number, and the number of the first part should be 0~31, and numbers of other parts should be larger than 31. The requested re should match the following

Re: Parsing data from URL

2005-04-24 Thread could ildg
I think it depends on the server On 24 Apr 2005 17:24:18 -0700, Harlin Seritt <[EMAIL PROTECTED]> wrote: > I am trying to do the following: > > > > import urllib > > url = 'http://www.website.com/file.shtml' > dat = urllib.urlopen(url, 'r').read() > print dat > > When I do so, I get the follo

Why does python class have not private methods? Will this never changed?

2005-04-19 Thread could ildg
Python is an oop language, but why does it hava not private methods? And it even has not real private fields. Will this never changed? Private stuff always makes programming much easier. -- 鹦鹉聪明绝顶、搞笑之极,是人类的好朋友。 直到有一天,我才发觉,我是鹦鹉。 我是翻墙的鹦鹉。 -- http://mail.python.org/mailman/listinfo/python-list

Re: how can I extract all urls in a string by using re.findall() ?

2005-04-07 Thread could ildg
I agree with Cappy2112. I got more puzzled after I read the docs On 7 Apr 2005 15:13:04 -0700, Cappy2112 <[EMAIL PROTECTED]> wrote: > >>Reading the documentation on re might be helpfull here :-P > Many times, the python docs can make the problem more complicated, > espcecially with regexes. > > -

Re: how can I extract all urls in a string by using re.findall() ?

2005-04-07 Thread could ildg
; for m in re.finditer(url, html) : > print m.group() > > or you could replace all your paranthesis with the non-grouping > version. That is, all brackets (...) with (?:...) > > > On Apr 7, 2005 7:35 AM, could ildg <[EMAIL PROTECTED]> wrote: > > I want to retrieve

how can I extract all urls in a string by using re.findall() ?

2005-04-06 Thread could ildg
I want to retrieve all urls in a string. When I use re.fiandall, I get a list of tuples. My code is like below: [code] url=unicode(r"((http|ftp)://)?[\d]+\.)+){3}[\d]+(/[\w./]+)?)|([a-z]\w*((\.\w+)+){2,})([/][\w.~]*)*)") m=re.findall(url,html) for i in m: print i [/code] html is a variable

Is it possible to distinguish between system environment variables and the user ones?

2005-04-05 Thread could ildg
To a environment variable in Windows, can python know if it is a system environment variable or a current-user environment variable? -- 鹦鹉聪明绝顶、搞笑之极,是人类的好朋友。 直到有一天,我才发觉,我是鹦鹉。 我是翻墙的鹦鹉。 -- http://mail.python.org/mailman/listinfo/python-list

Re: How to merge two binary files into one?

2005-04-05 Thread could ildg
I'm so glad that this this problem has so many recipes. On Apr 5, 2005 1:57 PM, Andrew Dalke <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: > > For large files, something like this is probably a better idea: > > Or with the little-used shutil module, and keeping your > nomenclature and block s

Re: How to merge two binary files into one?

2005-04-04 Thread could ildg
Thank Grant, it works well. On Apr 5, 2005 10:54 AM, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2005-04-05, could ildg <[EMAIL PROTECTED]> wrote: > >> > I want to merge file A and file B into a new file C, All of > >> > them are binary. > >> >

Re: How to merge two binary files into one?

2005-04-04 Thread could ildg
Thank you! Python is really magic, even merge file can use "+". On Apr 5, 2005 9:20 AM, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2005-04-05, could ildg <[EMAIL PROTECTED]> wrote: > > > I want to merge file A and file B into a new file C, All of > > th

How to merge two binary files into one?

2005-04-04 Thread could ildg
I want to merge file A and file B into a new file C, All of them are binary. How to do that? thanks a lot. -- 鹦鹉聪明绝顶、搞笑之极,是人类的好朋友。 直到有一天,我才发觉,我是鹦鹉。 我是翻墙的鹦鹉。 -- http://mail.python.org/mailman/listinfo/python-list

what's the use of __repr__?when shall I use it?

2005-03-31 Thread could ildg
What's the difference between __repr__ and __str__? When will __repr__ be useful? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to use "__new__"?

2005-03-29 Thread could ildg
<[EMAIL PROTECTED]> wrote: > could ildg wrote: > > As there is already __init__, why need a __new__? > > What can __new__ give us while __init__ can't? > > In what situations we should use __new__? > > And in what situations we must use __new__? > > Can __new__

How to use "__new__"?

2005-03-29 Thread could ildg
As there is already __init__, why need a __new__? What can __new__ give us while __init__ can't? In what situations we should use __new__? And in what situations we must use __new__? Can __new__ take the place of __init__? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to add a string to the beginning of a large binary file?

2005-03-28 Thread could ildg
I'm not going to, I just want to know how to manipulate a large file and insert or delete some stuff in it. On Mon, 28 Mar 2005 09:43:41 +0200, Patrick Useldinger <[EMAIL PROTECTED]> wrote: > could ildg wrote: > > I want to add a string such as "I love you" to the b

how to add a string to the beginning of a large binary file?

2005-03-27 Thread could ildg
I want to add a string such as "I love you" to the beginning of a binary file, How to? and how to delete the string if I want to get the original file? thanks. -- http://mail.python.org/mailman/listinfo/python-list