Re: where is python on linux?

2007-01-09 Thread Kevin Yuan
Frank Potter wrote: >> ... where is the executable python file? ... >> > > does > > whereis python "whereis" is cool! -- http://mail.python.org/mailman/listinfo/python-list

Re: zip unzip?

2005-12-28 Thread Kevin Yuan
:)He/She certainly knows. Just reminds us of zip! :);):)2005/12/29, Fredrik Lundh <[EMAIL PROTECTED]>: KraftDiner wrote:> I have two lists...>> a=[1,2,3]> b=[4,5,6]>> n=0> for i in a:>print i, b[n]>n=n+1>> how can i have two iterators on my for loop? > rather than have to use the counter n?

Re: Redirecting both stdout and stderr to the same file

2005-12-27 Thread Kevin Yuan
You should redirecte sys.stderr if you want to log error message.   saveout = sys.stdout   saveerr = sys.stderr   fsock = open('runtime.log', 'w')   sys.stdout = sys.stderr = fsock2005/12/28, Randy Kreuziger <[EMAIL PROTECTED]>: Can stdout and stderr be redirected to the same file?  I would li

Re: print UTF-8 file with BOM

2005-12-23 Thread Kevin Yuan
system, and try read a UTF-8 filethat save chinese. Regards, David2005/12/23, Kevin Yuan <[EMAIL PROTECTED]>:> import codecs> def read_utf8_txt_file (filename):> fileObj = codecs.open ( filename, "r", "utf-8" )> content = fileObj.read()

Re: print UTF-8 file with BOM

2005-12-22 Thread Kevin Yuan
import codecsdef read_utf8_txt_file (filename):    fileObj = codecs.open( filename, "r", "utf-8" )    content = fileObj.read()    content = content[1:] #exclude BOM     print content     fileObj.close()    read_utf8_txt_file("e:\\u.txt")22 Dec 2005 18:12:28 -0800, [EMAIL PROTECTED] < [EMAIL PROTECT

Re: Please enlighten me about PyPy

2005-12-22 Thread Kevin Yuan
2005/12/22, Steve Holden <[EMAIL PROTECTED]>: Fairly standard bootstrapping technique..Thanks, I get it.BTW I like the word "bootstrapping", very vivid, isn't it?:) -- http://mail.python.org/mailman/listinfo/python-list

Re: Please enlighten me about PyPy

2005-12-21 Thread Kevin Yuan
21 Dec 2005 19:33:20 -0800, Luis M. González <[EMAIL PROTECTED]>: ... ...This implementation requires a minimal core, writen in a restrictedsubset of python called "rpython". This subset avoids many of the mostdynamic aspects of python, making it easier to authomatically translate it to C through a

Re: modify a long-running python script while it is running?

2005-12-20 Thread Kevin Yuan
2005/12/20, Peter Hansen <[EMAIL PROTECTED]>: Kevin Yuan wrote:> I have a silly question: Can  *VERY*  large script cause memory overflow> if python load all the entire script file into memory?If you have a script that is literally larger than memory, then what else would happen but

Re: How to get the path of current running python script?

2005-12-20 Thread Kevin Yuan
Oh, my god! I forgot that python is written in C!int main(int argc, char* argv[]){     printf(argv[0]);    return 0; }*argv[0]* also woks here!!:) :) :)Thank you very much!!2005/12/20, Tim Williams (gmail) <[EMAIL PROTECTED]>: On 20/12/05, Kevin Yuan <[EMAIL PROTECTED]> wrote:

How to get the path of current running python script?

2005-12-20 Thread Kevin Yuan
I tried the following  getFilePath = lambda name: os.path.normpath('%s\\%s' % (sys.modules[name].prefix, sys.modules[name].__name__)) getFilePath('__main__')Traceback (most recent call last):   File "", line 1, in ?  File "", line 1, in AttributeError: 'module' object has no attribute 'pr

Re: How to call function which is in one program ...

2005-12-20 Thread Kevin Yuan
Another thing to remeber: Make sure the first.py and second.py are locateed in the same directory OR the path of first.py is in *sys.path*. Otherwise you'll get an exception. 2005/12/20, Fredrik Lundh < [EMAIL PROTECTED]>:"Shahriar Shamil Uulu" wrote: > i got another questions. For example i have t

Re: How to call function which is in one program ...

2005-12-20 Thread Kevin Yuan
19 Dec 2005 23:56:04 -0800, Shahriar Shamil Uulu <[EMAIL PROTECTED]>: Dear All,i got another questions. For example i have two programs in pythonlike: first.py, second.py.In first.py i have a function test() like:# first.py...def test(name):  print name so other functions==

Re: What is unique about Python?

2005-12-19 Thread Kevin Yuan
2005/12/20, Murtog (sent by Nabble.com) <[EMAIL PROTECTED]>: I would say to your teacher that Python is one of the few languagens that are fun to program with. It realy is! I have to say it although I have used it for only 3 days!  -- http://mail.python.org/mailman/listinfo/python-list

Re: modify a long-running python script while it is running?

2005-12-19 Thread Kevin Yuan
2005/12/20, Mike Meyer <[EMAIL PROTECTED]>: Benjamin Rutt <[EMAIL PROTECTED]> writes:> I suppose this question could be reformatted as "does CPython read the> entire script file into memory and then close the file before > executing the script, making it safe for me to modify the script after> I kn

Re: Testing the availability of a module

2005-12-19 Thread Kevin Yuan
2005/12/19, Bo Peng <[EMAIL PROTECTED]>: Dear list,Is there a better way than doingtry:   import aModuleexcept:   has_aModule = Falseelse:   has_aModule = TrueThe main concern here is that loading aModule is unnecessary (and may take time).If loading aModule is unnecessary, the best way is not load

Re: how to remove duplicated elements in a list?

2005-12-19 Thread Kevin Yuan
2005/12/19, Brian van den Broek <[EMAIL PROTECTED]>: [EMAIL PROTECTED] said unto the world upon 2005-12-19 02:27:> Steve Holden wrote:>>>Kevin Yuan wrote:>>>>>How to remove duplicated elements in a list? eg. >>>[1,2,3,1,2,3,1,2,1,2,1,3] -

Re: i need your help

2005-12-19 Thread Kevin Yuan
You may use IDLE in the Start menu2005/12/19, Steve Holden <[EMAIL PROTECTED]>: emrah gün wrote:>> hi.i dont know it is true or not to write you about that.I ve problem to> run phyton in my personal computer.I install it and there is no error> when installing but when i want to run pythonw.exe, no

how to remove duplicated elements in a list?

2005-12-18 Thread Kevin Yuan
How to remove duplicated elements in a list? eg. [1,2,3,1,2,3,1,2,1,2,1,3] -> [1,2,3]?Thanks!! -- http://mail.python.org/mailman/listinfo/python-list