Re: How do you do this in python?

2005-11-04 Thread George Yoshida
[EMAIL PROTECTED] wrote: > Pass your script to Perl via standard input: > echo "print 'Hello, world'" | perl - $ echo "print 'hello, world'" | python - hello, world Cheers, -- george -- http://mail.python.org/mailman/listinfo/python-list

Re: Help sorting a list by file extension

2005-08-11 Thread George Yoshida
Bengt Richter wrote: [name for dec,name in sorted((int(nm.split('.')[1]),nm) for nm in namelist)] > > ['test.1', 'test.2', 'test.3', 'test.4', 'test.10', 'test.15', 'test.20'] Giving a key argument to sorted will make it simpler:: >>> sorted(namelist, key=lambda x:int(x.rsplit('.')[-1])) --

Re: couple of new python articles on onlamp

2005-06-03 Thread George Yoshida
Kongulo(google crawling tool) seems to be using your App, py2exe. Great work, Thomas! Thomas Heller wrote: > Jeremy Jones <[EMAIL PROTECTED]> writes: > > >>I've got a couple of new articles on ONLamp: >> >>Writing Google Desktop Search Plugins >>http://www.onlamp.com/pub/a/python/2005/06/01/kong

Re: Shift-JIS to UTF-8 conversion

2005-05-20 Thread George Yoshida
PyTJ wrote: > I need to convert a Japanese Shift-JIS CSV file to Unicode UTF-8. > > My machine is a Windows 98 english computer with Python 2.3.4 > > Any hints?. > First, you need to install codecs to support japanese encodings. Python 2.3.* does not support SJIS by default. I'll give you two

Re: RFC 2822 format date printing function in python

2005-05-06 Thread George Yoshida
praba kar wrote: >In Php we can print RFC 2822 formatted date by > date('r') with parameter r. Then it will print the > below format date. > "Thu, 7 Apr 2005 01:46:36 -0300". > I want to print same RFC 2822 format in python. Is it > possible in python? . If possible kindly mention the

Re: Documenting Python code.

2005-05-03 Thread George Yoshida
Isaac Rodriguez wrote: > Python is a dynamically typed language, which makes me think of the > importance of documenting not only the purpose of a particular function or > class method, but also what requirements should be met by the objects passed > as parameters, what will the function retu

Re: Using wildcards...

2005-05-02 Thread George Yoshida
Harlin Seritt wrote: > {1:1} Random text here. {1:2} More text here. and so on. > > Of course the {*} can be of any length, so I can't just do .split() > based on the length of the bracket text. What I would like to do is to > .split() using something akin to this: > > textdata.split('{*}') # The

Re: Python interpreter error: unsupported operand type(s) for -: 'tuple' and 'int'

2005-03-29 Thread George Yoshida
Rakesh wrote: > To quote a much smaller trimmed-down example, here is how it looks > like: > ## --- > # Entry Point to the whole program > ## --- > def main(): > mylist = GenerateList() > minnumber = min

Re: interactive execution

2005-02-08 Thread George Yoshida
Jive Dadson wrote: I've got some code that compiles some text and then executes it. When the string is "print 'Hello'", it prints "Hello". I get no exception when I compile and execute "foo = 555". If I then compile and exec "print foo", I get a name error. The variable foo is undefined. My assu

Re: Proccess termination

2005-01-28 Thread George Yoshida
alexrait1 wrote: I use popen.popen2 or popen.popen3 to start a new process and read from it's stdout/ write to it's stdin. But I need a way to know when a process terminates. Do you know about a library that provides these tools other then the standard os module... or should I use it otherwise? po