Re: [Tutor] Exec(uting) Code in a Dictionary?

2009-02-08 Thread spir
Le Sat, 07 Feb 2009 13:50:01 -0800, Wayne Watson sierra_mtnv...@sbcglobal.net a écrit : That's something for me to ponder, setattr. I'd rather not go off and pick up on something like ConfigParser at this stage. I'd like to keep this code somewhat simple and easy to understand, but yet have

Re: [Tutor] Question on how to open other programs and files

2009-02-08 Thread Alan Gauld
Hi haztan...@gmail.com wrote I have a question regarding how to open other programs and files in Python code. I am creating a simple interface and I want it to be able to open other files, such as a text file or a pdf file. OK, lets clarify something first. When you say open do you mean

Re: [Tutor] WINSOCK stdin question

2009-02-08 Thread Alan Gauld
Yes, this is exactly what I am looking to accomplish. On one host I have an application that is sending cmd.exe to a second host. OK, how is that application doing that? What port is it sending the output to on the remote host? You say CMD.exe but that is the windows shell. There is no

[Tutor] Is this correct?

2009-02-08 Thread cclpianos
HI, I just realized that I shouldn't enclose my project in an attachment. This is my first attempt to string together py-code. Is this correct? And how would a pro word this? It seems like an awful lot of code for such a small task. Thanks in advance, Pat

Re: [Tutor] Oops! I just corrected my file:RE Completed project is this correct?

2009-02-08 Thread Kent Johnson
I guess this is homework so I will keep my comments fairly general. You have a lot of tests on count. Are they all needed? The code might be clearer if tuition was a positive number. newPrincipal and newTuition could have better names I don't think you need so many variables, balance, newBalance

[Tutor] Fwd: Oops! I just corrected my file:RE Completed project is this correct?

2009-02-08 Thread Kent Johnson
-- Forwarded message -- From: cclpia...@comcast.net Date: Sun, Feb 8, 2009 at 11:32 AM Subject: Re: [Tutor] Oops! I just corrected my file:RE Completed project is this correct? To: Kent Johnson ken...@tds.net Oh one thing, I'm not a student at a university. But I am completing

Re: [Tutor] Picking up citations

2009-02-08 Thread Kent Johnson
I guess I'm in the mood for a parsing challenge this weekend, I wrote a PLY version of the citation parser, see attached. It generates exactly the output you asked for except for the inclusion of In in the name. Kent # Parser for legal citations, PLY version from ply import lex, yacc text =

[Tutor] calling other process?

2009-02-08 Thread Bernard Rankin
Hello, I've been reading the Python docs on how to call a 2nd program and getting it's output, and would up here: http://docs.python.org/library/subprocess.html Is: from subprocess import Popen output = Popen([mycmd, myarg], stdout=PIPE).communicate()[0] Really the replacement for: output

Re: [Tutor] Is this correct?

2009-02-08 Thread bob gailer
For what its worth - here is my revision of your program. I did not send it earlier because I kept finding things that led me to want to see and verify the fundamental algorithm. But now I think my observations could also be useful. My changes: Changed indentation from 8 to 2. For me this is

Re: [Tutor] Picking up citations

2009-02-08 Thread Emmanuel Ruellan
Dinesh B Vadhia dineshbvad...@hotmail.com wrote: Hi! I want to process text that contains citations, in this case in legal documents, and pull-out each individual citation. Here is my stab at it, using regular expressions. Any comments welcome. I had to use two regexes, one to find all

Re: [Tutor] calling other process?

2009-02-08 Thread Alan Gauld
Bernard Rankin beranki...@yahoo.com wrote http://docs.python.org/library/subprocess.html Is: from subprocess import Popen output = Popen([mycmd, myarg], stdout=PIPE).communicate()[0] Really the replacement for: output = `mycmd myarg` Yes, because it works more consistently and reliably

Re: [Tutor] calling other process?

2009-02-08 Thread Bernard Rankin
Is: from subprocess import Popen output = Popen([mycmd, myarg], stdout=PIPE).communicate()[0] Really the replacement for: output = `mycmd myarg` Yes, because it works more consistently and reliably across operating systems for one reason. Its also much more powerful and

Re: [Tutor] calling other process?

2009-02-08 Thread ALAN GAULD
from subprocess import Popen output = Popen([mycmd, myarg], stdout=PIPE).communicate()[0] Not to discount the Python Zen, but me thinks there could be a little more Make easy things easy, and hard things possiblein this aspect of Python . :) I sympatjise but to be honest I never

Re: [Tutor] calling other process?

2009-02-08 Thread Bernard Rankin
I sympatjise but to be honest I never use the backtick trick except at the prompt as a quick and dirty hack. It ranks alongside the _ variable in my book as an interactive utility but it's too easy to miss or misread to use in real code. But even popen is easier, I agree, and

Re: [Tutor] Is this correct?

2009-02-08 Thread bob gailer
Please always reply-all so a copy goes to the list. We all participate and learn. Would you also respond to my requests for clarified algorithm? cclpia...@comcast.net wrote: Hi Bob, Thanks for your input! I ran the program in IDLE and it worked just fine. Apparently my calculations were

Re: [Tutor] UPDATED: Question on how to open other programs and files

2009-02-08 Thread Hi
Re: Question on how to open other programs and files (Alan Gauld) Sorry for being confusing on my last e-mail. I will try to clarify my intents a bit further. In short, I want to be able to read the data in the file as well as launch document viewer in Python. For one of the files I want to read

Re: [Tutor] Picking up citations

2009-02-08 Thread Kent Johnson
On Sun, Feb 8, 2009 at 5:53 PM, Emmanuel Ruellan emmanuel.ruel...@gmail.com wrote: Dinesh B Vadhia dineshbvad...@hotmail.com wrote: Hi! I want to process text that contains citations, in this case in legal documents, and pull-out each individual citation. Here is my stab at it, using

Re: [Tutor] UPDATED: Question on how to open other programs and files

2009-02-08 Thread David
Hi wrote: Re: Question on how to open other programs and files Here is one way; #!/usr/bin/python import subprocess print Starting Adobe Reader def startReader(): myreader = acroread fname = test.pdf print Loading , fname subprocess.call([myreader, fname])