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

2009-02-07 Thread Hi
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. However, those files are usually associated with other programs - for instance, gedit for text and docum

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

2009-02-07 Thread cclpianos
Forget the first, this is the corrected version. Thanks, Pat# Problem Set 1 # Name P Wethington # Collaborators :None # Time #1:00 # This is a program intended to compute the number of students who will benefit from a grant, also what # amount the last student will receive. principal =

[Tutor] Completed project. Is this correct? Can I simplify my formulas?

2009-02-07 Thread cclpianos
Hello, I've enclosed a completed project (my first!) and would like to know of it's accuracy. Also, what I could do to simplify the language. Thanks, Pat # Problem Set 1 # Name P Wethington # Collaborators :None # Time #1:00 # This is a program intended to compute the number of stude

Re: [Tutor] Picking up citations

2009-02-07 Thread Dinesh B Vadhia
Kent I've just thought that as an initial attempt, the last name (of the name before the v.) is sufficient ie. "Turner v. Fouche, 396 U.S. 346 (1970)" instead of "Lathe Turner v. Fouche, 396 U.S. 346 (1970)" as we are only using the citations internally and not displaying publicly. That solves

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

2009-02-07 Thread Wayne Watson
Title: Signature.html 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 some flexibility for changes. Kent Johnson wrote: On Sat, Feb 7,

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

2009-02-07 Thread Kent Johnson
On Sat, Feb 7, 2009 at 4:21 PM, Wayne Watson wrote: > Here's more detail. What I was hoping for was something like: > > exec "=" dcon > > This is fictitious of course, but would mean assign the values in [1] to > [0]. > Yes, it would be easy to loop and assemble elements into a string that would >

Re: [Tutor] Picking up citations

2009-02-07 Thread Marc Tompkins
On Sat, Feb 7, 2009 at 1:19 PM, Kent Johnson wrote: > > It is correct except for the inclusion of "In" in the name and the > extra space before the comma separating the page numbers in the last > citation. > As I've been reading along, I've been thinking that the word "In" qualifies as a "magic

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

2009-02-07 Thread Wayne Watson
Title: Signature.html Here's more detail. What I was hoping for was something like:   exec "=" dcon This is fictitious of course, but would mean assign the values in [1] to [0]. Yes, it would be easy to loop and assemble elements into a string that would be executed by exec (or eval), or use s

Re: [Tutor] Picking up citations

2009-02-07 Thread Kent Johnson
It turns out you can use Or expressions to cause a kind of backtracking in Pyparsing. This is very close to what you want: Name1 = Forward() Name1 << Combine(Word(alphas) + Name1 | Word(alphas) + Suppress('v.'), joinString=' ', adjacent=False).setResultsName('name1') Name2 = Combine(OneOrMore(Word

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

2009-02-07 Thread Kent Johnson
On Sat, Feb 7, 2009 at 3:20 PM, Wayne Watson wrote: > Is it possible to do some thing like this with exec: > > dcon0 = {'long':120.00, 'lat': 39.00, 'year': 2009} > > Can I use exec or eval simply on this to get: > long = 120.00 > lat = 39.00 > year = 2009 > > That is, initialize each of these t

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

2009-02-07 Thread Wayne Watson
Title: Signature.html Is it possible to do some thing like this with exec: dcon0 = {'long':120.00, 'lat': 39.00, 'year': 2009} Can I use exec or eval simply on this to get: long = 120.00 lat   = 39.00 year = 2009 That is, initialize each of these three variables. -- Wayne Watso

Re: [Tutor] Picking up citations

2009-02-07 Thread Kent Johnson
On Sat, Feb 7, 2009 at 11:53 AM, Dinesh B Vadhia wrote: > Wow Kent, what a great start! > > I found this > http://mail.python.org/pipermail/python-list/2006-April/376149.html which > lays out some patterns of legal citations ie. Here is another good reference: http://philip.greenspun.com/politics

Re: [Tutor] Closing and Open File--TkFileDialogs

2009-02-07 Thread Wayne Watson
Title: Signature.html Fine. Onto another trail. Kent Johnson wrote: On Sat, Feb 7, 2009 at 10:09 AM, Wayne Watson wrote: I may be mistaken, but I do not think any of the documentation I've seen on these two methods states what type of result is produced. That is really my point

Re: [Tutor] Closing and Open File--TkFileDialogs

2009-02-07 Thread Kent Johnson
On Sat, Feb 7, 2009 at 10:09 AM, Wayne Watson wrote: > I may be mistaken, but I do not think any of the documentation I've seen on > these two methods states what type of result is produced. That is really my > point. I had to find out the hard way by printing out the result. I'm mystified. "Ret

Re: [Tutor] Picking up citations

2009-02-07 Thread Dinesh B Vadhia
Wow Kent, what a great start! I found this http://mail.python.org/pipermail/python-list/2006-April/376149.html which lays out some patterns of legal citations ie. 1. Two names, consisting of one or more words, separated by a "v." 2. One, two, or three citations, each of which has a volume numbe

Re: [Tutor] Closing and Open File--TkFileDialogs

2009-02-07 Thread W W
On Sat, Feb 7, 2009 at 9:09 AM, Wayne Watson wrote: > Yes, amazingly enough, I'm quite familiar with basic file operations. :-) > I'm certainly no expert at all variations of it. > > Now for a related question. I'm using Win XP. One of the arguments is the > default_path. I would like it to be t

Re: [Tutor] Closing and Open File--TkFileDialogs

2009-02-07 Thread Wayne Watson
Title: Signature.html Yes, amazingly enough, I'm quite familiar with basic file operations. :-) I'm certainly no expert at all variations of it. Output from the sample program: 1. file is open and ready for writing. Here's return for asksaveasFILE:  2. you opened in write mode. return for

[Tutor] PyCon 2009 Tutorial Days

2009-02-07 Thread gslindstrom
Registration for PyCon 2009 (US) is open. Because of the popularity of the tutorials in years past, this year features 2 days of tutorials (32 total class on Wednesday, March 25 and Thursday, March 26) including: - 2

Re: [Tutor] Picking up citations

2009-02-07 Thread Kent Johnson
On Sat, Feb 7, 2009 at 1:11 AM, Dinesh B Vadhia wrote: > Hi! I want to process text that contains citations, in this case in legal > documents, and pull-out each individual citation. Here is a sample text: > The results required are: > > Carter v. Jury Commission of Greene County, 396 U.S. 32

Re: [Tutor] WINSOCK stdin question

2009-02-07 Thread ALAN GAULD
CCing the list... Please use ReplyAll when replying to tutor mail. From: Tom Green To: Alan Gauld Sent: Saturday, 7 February, 2009 11:42:23 AM Subject: Re: [Tutor] WINSOCK stdin question Yes, this is exactly what I am looking to accomplish. On one host I have

Re: [Tutor] Picking up citations

2009-02-07 Thread Kent Johnson
On Sat, Feb 7, 2009 at 1:11 AM, Dinesh B Vadhia wrote: > Hi! I want to process text that contains citations, in this case in legal > documents, and pull-out each individual citation. > Before attempting to solve this problem I thought I'd first ask if anyone > has seen a solution before? This g

Re: [Tutor] Picking up citations

2009-02-07 Thread spir
Le Fri, 6 Feb 2009 22:11:14 -0800, "Dinesh B Vadhia" a écrit : > Hi! I want to process text that contains citations, in this case in legal > documents, and pull-out each individual citation. Here is a sample text: > > text = "Page 500 Carter v. Jury Commission of Greene County, 396 U.S. 320,

Re: [Tutor] Closing and Open File--TkFileDialogs

2009-02-07 Thread Kent Johnson
On Fri, Feb 6, 2009 at 9:59 PM, Wayne Watson wrote: > Yes, I probably confused the two. The link you mentioned is the one I found > most helpful of the ones I mentioned. Note that his descriptions here, like > others, and to me at least, are minimal. I think, as Alan says, there just is not much

Re: [Tutor] Closing and Open File--TkFileDialogs

2009-02-07 Thread Wayne Watson
Title: Signature.html (Guilty again of not hitting Reply All. I responded (to Kent) 8 hours ago. If anyone is against the controversial way this mail list handles replies, put me at the top of the list. In my book this list is unique in the way it handles replies.) Yes, I probably confused the

Re: [Tutor] Closing and Open File--TkFileDialogs

2009-02-07 Thread Alan Gauld
"Wayne Watson" wrote I'm using asksaveasfilename, and, as I understand it, it returns the file name to me in write mode. No it retuirns the filename. It is a string. Exactly like you would get from raw_input() in a command line application. It has no "mode", it is just a string. It is up t

Re: [Tutor] WINSOCK stdin question

2009-02-07 Thread Alan Gauld
"Tom Green" wrote I am trying to reproduce what Netcat does. > sends out a reverse shell (CMD prompt). I have a listening > Python socket > and I would like to know how I can redirect the CMD prompt to > stdin, so I > can interact with the host that is sending the shell. Basically > thi

Re: [Tutor] Designing a Dialog in Python

2009-02-07 Thread ALAN GAULD
> I'm aware of a visual design tool for Tkinter. There are a couple, none of them great. I use PySpecTcl for a while which, as you might guess, is a Python version of the Tcl tool SpecTcl. The latter was developed by Sun when they were sponsoring Tcl - just before they became obsessed with Jav

Re: [Tutor] Python 2.6.1 + Linux Ubuntu (Gutsy Gibbon)

2009-02-07 Thread Noufal Ibrahim
Eric Dorsey wrote: I am trying to teach myself Linux, and so I'm running Ubuntu (Gutsy Gibbon) as a virtual machine. I went to terminal, started up Python and realized it was version 2.5 so I thought I'd just upgrade to 2.6.1 After doing some Googling around, it seems that Ubuntu is highly reli