[Tutor] Expanding a Python script to include a zcat and awk pre-process

2010-01-07 Thread galaxywatcher
I wrote a simple Python script to process a text file, but I had to run a shell one liner to get the text file primed for the script. I would much rather have the Python script handle the whole task without any pre-processing at all. I will show 1) a small sample of the text file, 2) my scr

Re: [Tutor] formatting*

2010-01-07 Thread Lowell Tackett
Well, Ok then, I have switched to plain text to transmit this response. I will follow it over to the archive forum to see how the difference works. In the meantime...this back-and-forth dialog has at least made me aware of gmane, a website I had not been aware of. Interesting place. I was ove

Re: [Tutor] formatting*

2010-01-07 Thread Alan Gauld
"Lowell Tackett" wrote Well, not a lot of luck. What I use is Yahoo mail (whatever that is---a "thick" client??), and thus far I can't find any tool bars that offer help. A thick client is an application that runs on your desktop with built in intelligence. A thin client is a GUI within a

Re: [Tutor] formatting*

2010-01-07 Thread Lowell Tackett
Well, not a lot of luck.  What I use is Yahoo mail (whatever that is---a "thick" client??), and thus far I can't find any tool bars that offer help. An odd aside, however--I went into the Tutor Archives forum and pulled up the Page Source (HTML formatting template) and lo and behold all my parag

Re: [Tutor] (no subject)

2010-01-07 Thread bob gailer
kumar s wrote: dear tutors: I have two files. I want to take coordiates of an row in fileA and find if they are in the range of coordinates in fileB. If they are, I want to be able to map else, pass. thanks kumar file a: name loc x y a 4 4081159640811620

Re: [Tutor] (no subject)

2010-01-07 Thread Alan Gauld
"kumar s" wrote f1 = open('fileA','r') f2 = open('fileB','r') da = f1.read().split('\n') dat = da[:-1] ba = f2.read().split('\n') bat = ba[:-1] You could replace all that with dat = open('fileA.dat').readlines() bat = open('fileB').readlines() for m in dat: col = m.split('\t')

Re: [Tutor] formatting*

2010-01-07 Thread ALAN GAULD
> I'm using Mandrake 10.1 [Linux] OS to view the internet thru Firefox. > In my mailbox, everything is fine--my stuff formats well (and when it > comes back to me as Tutor 'mail' it also formats correctly). > > The problem is over at the Tutor Archives (mail.python.org/pipermail/tutor), > i.e

Re: [Tutor] formatting*

2010-01-07 Thread Lowell Tackett
I'm using Mandrake 10.1 [Linux] OS to view the internet thru Firefox.  In my mailbox, everything is fine--my stuff formats well (and when it comes back to me as Tutor 'mail' it also formats correctly). The problem is over at the Tutor Archives (mail.python.org/pipermail/tutor), i.e., the Tutor

[Tutor] (no subject)

2010-01-07 Thread kumar s
dear tutors: I have two files. I want to take coordiates of an row in fileA and find if they are in the range of coordinates in fileB. If they are, I want to be able to map else, pass. thanks kumar file a: name loc x y a 4 4081159640811620 b 4

Re: [Tutor] manipulting CSV files

2010-01-07 Thread Alan Gauld
"Lowell Tackett" wrote until I ran across the csv module. Had accomplished this: coord = csv.reader(open('true_coord')) for line in coord: print line [' 1001', ' 342821.71900', ' 679492.08300', ' 0.0', ' '] [' 1002', ' 342838.55786', ' 679909.81375', ' 0.0', ' '] when I

Re: [Tutor] formatting*

2010-01-07 Thread Alan Gauld
"Lowell Tackett" wrote *No, not in Python...in this Tutor format. How do I include line breaks in text so the lines in the Tutor Archives wrap (as opposed to stretching halfway to Idaho)? How are you viewing the messages? I have never seen that problem. Are you using a web browser or a new

Re: [Tutor] manipulting CSV files

2010-01-07 Thread Emile van Sebille
On 1/7/2010 10:26 AM Lowell Tackett said... I suspect using csv is overkill, but you'd need to be working with Dialects by first creating a Dialect, then applying the Dialect to your source data. I've not done that, and for your use case, I think I'd do something like: filedata = '''1001, 342

[Tutor] formatting*

2010-01-07 Thread Lowell Tackett
*No, not in Python...in this Tutor format.  How do I include line breaks in text so the lines in the Tutor Archives wrap (as opposed to stretching halfway to Idaho)? >From the virtual desk of Lowell Tackett  ___ Tutor maillist - Tutor@pytho

[Tutor] manipulting CSV files

2010-01-07 Thread Lowell Tackett
Displayed below is an extract from a CSV file that displays some [land surveying] coordinates: 1001, 342821.71900, 679492.08300,  0.0, 1002, 342838.55786, 679909.81375,  0.0, 1003, 342965.61860, 679911.34762,  0.0, 1004, 343012.82497, 680338.36624,  0.0, 1005, 3427

Re: [Tutor] Help with a Dictionary

2010-01-07 Thread Lie Ryan
On 1/8/2010 3:12 AM, Garry Bettle wrote: This is what I've come up with. Sorry, python is something I touch on occasionally: must do more! As the races are output, I build a dictionary of key=FixtureName and value=RaceTimes: RaceTime = marketResp.market.displayTime.time() cRaceTime = RaceTime

Re: [Tutor] Help with a Dictionary

2010-01-07 Thread Gerard Flanagan
Garry Bettle wrote: Howdy all, I hope this message finds you all well. I have a list that I output in the following order: 2010-01-07 1103 Sund A7 450m 2010-01-07 Sheff A7 500m 2010-01-07 1119 Sund A6 450m 2010-01-07 1128 Sheff A6 500m 2010-01-07 1134 Sund A5 450m 2010-01-07 1142 Sheff A7

Re: [Tutor] Help with a Dictionary

2010-01-07 Thread Alan Gauld
"Garry Bettle" wrote What I'd like to do, is output a transposed-like summary of just the Fixture + RaceTime. Sund 1103 1119 1134 1148 1204 1218 1232 1247 1304 1319 1333 1351 Sheff 1128 1142 1157 1212 1227 1242 1258 1312 1327 1344 1403 As the races are output, I build a dictionary of k

Re: [Tutor] Greetings Pythonistas

2010-01-07 Thread Lie Ryan
On 1/8/2010 12:15 AM, galaxywatc...@gmail.com wrote: This is my first post to the Python tutor list and I just wanted to introduce myself and give a little background on my skill level prior to asking for Python advice and programming tips. I am relatively new to Python, but I have been dabbling

Re: [Tutor] Help with a Dictionary

2010-01-07 Thread Garry Bettle
On Thu, Jan 7, 2010 at 15:26, Garry Bettle wrote: > > Howdy all, > > I hope this message finds you all well. > > I have a list that I output in the following order: > > 2010-01-07 1103 Sund A7 450m > 2010-01-07 Sheff A7 500m > 2010-01-07 1119 Sund A6 450m > 2010-01-07 1128 Sheff A6 500m > 201

Re: [Tutor] Greetings Pythonistas

2010-01-07 Thread Serdar Tumgoren
Welcome! You've come to the right place. > books at the moment and working through the exercises: Dive into Python by > Mark Pilgrim, and Python Programming - An Introduction to Computer Science > by Zelle. Those are both great books to start with, IMHO. You might want to also check out Beginning

[Tutor] question about for loops

2010-01-07 Thread Richard D. Moores
On Thu, Jan 7, 2010 at 05:03, Alan Plum wrote: > Variable unpacking works like this: > > points = [(0,0), (0,1), (0,2), (1,0), (1,1), (1,2), (2,0), (2,1), (2,2)] > > for (x,y) in points: >    print 'x: %d, y: %d' % (x, y) > > Without unpacking: > > for point in points: >    print 'x: %d, y: %d' %

Re: [Tutor] Help with a Dictionary

2010-01-07 Thread Benno Lang
On Thu, Jan 7, 2010 at 10:51 PM, Garry Bettle wrote: > I have a list that I output in the following order: > > 2010-01-07 1103 Sund A7 450m > 2010-01-07 Sheff A7 500m > 2010-01-07 1119 Sund A6 450m > 2010-01-07 1128 Sheff A6 500m > 2010-01-07 1134 Sund A5 450m > 2010-01-07 1142 Sheff A7 500m

Re: [Tutor] question about for loops

2010-01-07 Thread Richard D. Moores
Now I have a nice collection of examples, which to me are worth more than the sometimes inscrutable docs. My thanks to you three for taking the time to create the examples, and accompany them with understandable explanations. BTW I like Summerfield's book a lot, but he let me down on p.162. Dick

[Tutor] Help with a Dictionary

2010-01-07 Thread Garry Bettle
Howdy all, I hope this message finds you all well. I have a list that I output in the following order: 2010-01-07 1103 Sund A7 450m 2010-01-07 Sheff A7 500m 2010-01-07 1119 Sund A6 450m 2010-01-07 1128 Sheff A6 500m 2010-01-07 1134 Sund A5 450m 2010-01-07 1142 Sheff A7 500m 2010-01-07 1148

Re: [Tutor] question about for loops

2010-01-07 Thread taserian
On Thu, Jan 7, 2010 at 7:43 AM, Richard D. Moores wrote: > On p. 162 of "Programming In Python", 2nd ed., by Summerfield, the > section entitled "for Loops" begins: > > = > for expression in iterable: > for_suite > else: > else_suite > > The expressi

Re: [Tutor] question about for loops

2010-01-07 Thread Eike Welk
Hello Richard! On Thursday January 7 2010 13:43:26 Richard D. Moores wrote: > On p. 162 of "Programming In Python", 2nd ed., by Summerfield, the > section entitled "for Loops" begins: > > = > for expression in iterable: > for_suite > else: > else_

[Tutor] Greetings Pythonistas

2010-01-07 Thread galaxywatcher
This is my first post to the Python tutor list and I just wanted to introduce myself and give a little background on my skill level prior to asking for Python advice and programming tips. I am relatively new to Python, but I have been dabbling with unix shell scripting for at least 10 years

[Tutor] question about for loops

2010-01-07 Thread Richard D. Moores
On p. 162 of "Programming In Python", 2nd ed., by Summerfield, the section entitled "for Loops" begins: = for expression in iterable: for_suite else: else_suite The expression is normally either a single variable or a sequence of variables, usuall