Re: [Tutor] The Best Way to go About with Self Modifying Code/Code Generation?

2012-07-08 Thread Steven D'Aprano
Aaron Tp wrote: Hey all, I have a question on using self-modifying code/code generation in Python; namely how to do it. I know others have already said not to do this, and to be honest I was going to say that same thing, but I have changed my mind. Buggrit, this is Python, where we are all

Re: [Tutor] The Best Way to go About with Self Modifying Code/Code Generation?

2012-07-08 Thread Aaron Tp
Thank you all for your responses. I don't know if I have the capability to even complete such a project, or if I possess the necessary will to start, but at least I understand it a bit more than when I was starting. --Aaron ___ Tutor maillist - Tu

Re: [Tutor] Seeking help with reading and writing files in Python

2012-07-08 Thread David Rock
* Aristotle [2012-06-26 14:28]: > > The sequence of events that I am using now is to open a program that > will gather gallons used from user, call a module to make calculations, > use the info from the module to write info to a file named > FinalProjectBill.txt. > > After that is done, I ope

Re: [Tutor] Python and boot sequences

2012-07-08 Thread David Rock
* Dave Wilder [2012-06-28 12:54]: > > Can a Python script be written that has the ability to stop a Linux > device in the middle of a boot when a certain sequence occurs and then > perform an action? > > For example, when I boot my switch (w/ Linux OS 2.7.3), I want to stop > the boot when I see

Re: [Tutor] The Best Way to go About with Self Modifying Code/Code Generation?

2012-07-08 Thread Stefan Behnel
Steven D'Aprano, 08.07.2012 15:48: >> Hey all, I have a question on using self-modifying code/code generation >> in Python; namely how to do it. > > I know others have already said not to do this, and to be honest I was > going to say that same thing, but I have changed my mind. Buggrit, this is

Re: [Tutor] Seeking help with reading and writing files in Python

2012-07-08 Thread Alan Gauld
On 26/06/12 19:28, Aristotle wrote: The sequence of events that I am using now is to open a program that will gather gallons used from user, call a module to make calculations, use the info from the module to write info to a file named FinalProjectBill.txt. ... From Instructor: You should read

[Tutor] Mapping ID's for corresponding values in different Columns

2012-07-08 Thread Fred G
Hi-- My current input looks like the following: FILE1.csv PERSON_IDPERSON_NAME 1 Jen 2 Mike 3 Jim 4 5 Jane 6 Joe 7 Jake FILE2.csv PERSON_ID PERSON_NAME

Re: [Tutor] Mapping ID's for corresponding values in different Columns (UPDATE)

2012-07-08 Thread Fred G
I thought it made sense to read the two columns in File1 in as a dictionary (where the key is actually the name, so that we can search on it later), and the column of interest in File2 as a list. Finding the common values then is just: for item in file2_list: for line in file1_dict: if item

Re: [Tutor] Mapping ID's for corresponding values in different Columns (UPDATE)

2012-07-08 Thread Walter Prins
On 9 July 2012 00:50, Fred G wrote: > I thought it made sense to read the two columns in File1 in as a dictionary > (where the key is actually the name, so that we can search on it later), and yes... > the column of interest in File2 as a list. Finding the common values then > is just: > > for

Re: [Tutor] Python and boot sequences

2012-07-08 Thread Dave Wilder
The switch is in a state where user process can be run once the boot sequence has been halted (the aforementioned <9>). However the time between when the reboot is kicked off and when the asterisks appear (and the boot must be stopped), there is no shell Environment. I may be trying to hammer a

[Tutor] Reading a csv of coordinates, trying to write a csv of bearings.

2012-07-08 Thread Gregory Lund
I'm Not looking for an absolute solution, but perhaps some insight into some snippets of code, or suggestions of where I should seek out answers to this issue. Or where I've gone wrong below. NOTE: currently this 'code' below reads my file and writes a file, but what it's doing in the middl

[Tutor] using dynamic import statements

2012-07-08 Thread Chris Hare
Here is what I want to do: I have a bunch of modules to import. instead of duplicating a lot of code for each import, I want to do something like this: importList = [ "sys", "os", "imp", "stat", "re", "webbrowser", "Image", "StringIO", "shutil", "datetime" ] for object in importList: