[Tutor] Redirecting output + calling dos commands with input tail
Wed Jun 18 01:28:01 2003
def pypari(cmd): #call and execute a pari
f=open("pari.txt","w") #save command to a file
# p=instr(cmd,">") #check for dos redirection ">"
p=cmd.find(">") # better intrinsic function
to find occurrences
Works fine. No need for a new wheel here. In the meantime, I reviewed the
docs on string services
and found a lot of stuff that will take care of most of my wish list.
Moreover, the intrinsic function is 10 times faster than the user defined
Thanks for your work!
>From: Lloyd Kvam <email@example.com>
>To: cino hilliard <firstname.lastname@example.org>
>Subject: Re: [Tutor] Redirecting output + calling dos commands with input
>Date: Tue, 17 Jun 2003 19:13:51 -0400
>Your instr function could be replaced by an intrinsic python method.
>p=instr(cmd,">") # becomes
>find returns -1 if there is no match. Your instr function assumes that 0
>is a safe return value, but in other contexts you would not be able to
>distinguish between found in the first (zeroth) position and not found at
>Since a cmd can not legally begin with >, it isn't a problem here.
3 3 3 3 3 6 2
2 + 13 + 33 + 43 = 49 = 7 = 343 = 117649
The new MSN 8: advanced junk mail protection and 2 months FREE*