Re: [Tutor] Equivalent to perl -e

2006-10-16 Thread nibudh
On 10/17/06, David Rock <[EMAIL PROTECTED]> wrote: * Alan Gauld <[EMAIL PROTECTED]> [2006-10-16 17:32]:>> Why?> Why not just put it in a Python script?> I'm missing something I think. I don't think you are missing anything.  It was something that just sortof happened one day.  I was trying to do so

Re: [Tutor] Equivalent to perl -e

2006-10-16 Thread David Rock
* Alan Gauld <[EMAIL PROTECTED]> [2006-10-16 17:32]: > > Why? > Why not just put it in a Python script? > I'm missing something I think. I don't think you are missing anything. It was something that just sort of happened one day. I was trying to do something fairly simple in a shell script and

Re: [Tutor] Equivalent to perl -e

2006-10-16 Thread Mike Hansen
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of wesley chun > Sent: Monday, October 16, 2006 12:51 AM > To: Chris Lasher > Cc: Python Tutor > Subject: Re: [Tutor] Equivalent to perl -e > > > His lab maintains a s

Re: [Tutor] Equivalent to perl -e

2006-10-16 Thread Alan Gauld
"David Rock" <[EMAIL PROTECTED]> wrote in message > This is embedded inside a shell script. > > python -c ' > import time > import datetime > dtup_now = time.localtime() > y,m,d = dtup_now[:3] > d_today = datetime.datetime(y,m,d) > d_delta = datetime.timedelta(d_today.day) > last_month = d_today

Re: [Tutor] Equivalent to perl -e

2006-10-16 Thread David Rock
* Chris Lasher <[EMAIL PROTECTED]> [2006-10-15 22:07]: > Haha! I'll relay that message! Thanks Kent and Glenn! > Here is one I actually use in real life. I needed something to figure out what the previous year, month, etc for rolling up old log files. The best thing I could think of for date cal

Re: [Tutor] Equivalent to perl -e

2006-10-15 Thread wesley chun
> His lab maintains a significant amount of Perl code this sounds like a full-time job on its own. everyone brings up a good point... use the right tool for the job. if it's one-liners, that's what perl -e is made for. for everything else that you mentioned above, Python is the the one, prefera

Re: [Tutor] Equivalent to perl -e

2006-10-15 Thread Chris Lasher
Points well taken. In fact, the example he demonstrated to me as a one-liner was a regular expression as a line filter in Emacs--essentially just a grep. There's no Pythonic equivalent to this. Right tool for the right job, as you said. He was half-joking about not learning Python if it lacked the

Re: [Tutor] Equivalent to perl -e

2006-10-15 Thread Tim Peters
[Chris Lasher] > My professor and advisor has been "inspired" by me to give Python a > try. He's an avid Perl user, and challenged me with the following: > > What is the Python equivalent to perl -e ''? The initally attractive but unsatisfying answer is: python -c '' The reason it's "unsatis

Re: [Tutor] Equivalent to perl -e

2006-10-15 Thread Chris Lasher
Haha! I'll relay that message! Thanks Kent and Glenn! Chris On 10/15/06, Glenn T Norton <[EMAIL PROTECTED]> wrote: > Chris Lasher wrote: > > >My professor and advisor has been "inspired" by me to give Python a > >try. He's an avid Perl user, and challenged me with the following: > > > >What is th

Re: [Tutor] Equivalent to perl -e

2006-10-15 Thread Glenn T Norton
Chris Lasher wrote: >My professor and advisor has been "inspired" by me to give Python a >try. He's an avid Perl user, and challenged me with the following: > >What is the Python equivalent to perl -e ''? > >Embarassingly, I had no answer, but I figure, someone on the list will >know. His use of P

Re: [Tutor] Equivalent to perl -e

2006-10-15 Thread Kent Johnson
Chris Lasher wrote: > My professor and advisor has been "inspired" by me to give Python a > try. He's an avid Perl user, and challenged me with the following: > > What is the Python equivalent to perl -e ''? python -c More details here: http://linuxcommand.org/man_pages/python1.html Kent _

[Tutor] Equivalent to perl -e

2006-10-15 Thread Chris Lasher
My professor and advisor has been "inspired" by me to give Python a try. He's an avid Perl user, and challenged me with the following: What is the Python equivalent to perl -e ''? Embarassingly, I had no answer, but I figure, someone on the list will know. His use of Python is at stake; he threat