[Tutor] manipulating data

2007-11-07 Thread Bryan Fodness
I would like to have my data in a format so that I can create a contour plot. My data is in a file with a format, where there may be multiple fields field = 1 1a 0 2a 0 3a 5 4a 5 5a 5 6a 5 7a 5 8a 5 9a 0 10a 0 1b 0 2b 0 3b 5 4b

Re: [Tutor] making a typing speed tester

2007-11-07 Thread Evert Rol
Hi Tom, I'm trying to write a program to test someones typing speed and show them their mistakes. However I'm getting weird results when looking for the differences in longer (than 100 chars) strings: import difflib # a tape measure string (just makes it easier to locate a given index)

Re: [Tutor] New Introductory Book

2007-11-07 Thread Eddie Armstrong
Whatever the rationale for the price you could buy 2nd Ed 'Core', Chun *and *3rd edition(when it arrives) 'Learning Python', Lutz (the two standard, known and respected beginners texts) for the price of this. Mmm, I wonder what I would buy or rather have as a student. Eddie PS (My apologies

Re: [Tutor] manipulating data

2007-11-07 Thread Kent Johnson
Bryan Fodness wrote: I also have some information at the beginning of the file and between each field. Is there a way to get the info at the beginning and tell it once it sees Leaf 1A to read the values for the next 120 and then repeat until there are no more Fields. This should be a pretty

Re: [Tutor] manipulating data

2007-11-07 Thread Kent Johnson
Bryan Fodness wrote: I would like to have my data in a format so that I can create a contour plot. My data is in a file with a format, where there may be multiple fields field = 1 1a0 If your data is really this regular, it is pretty easy to parse. A useful technique is to access a

Re: [Tutor] New Introductory Book

2007-11-07 Thread bhaaluu
Greetings, Many books have the source code available for download somewhere, or even a sample chapter? Are the examples in the book complete programs, or are they snippets illustrating a concept? If the programs are complete, what type of programs are they (business, science, other)? Does the

[Tutor] In-place expansion of list members... possible?

2007-11-07 Thread Marc Tompkins
This question has probably been asked and answered many times, but I can't figure out how to word my question to get relevant results from Google. So I thought I'd try some human beings, eh? I'm working with delimited files (ANSI X12 EDI nonsense, to be precise.) First I load the records to a

Re: [Tutor] In-place expansion of list members... possible?

2007-11-07 Thread Eric Brunson
Marc Tompkins wrote: This question has probably been asked and answered many times, but I can't figure out how to word my question to get relevant results from Google. So I thought I'd try some human beings, eh? I'm working with delimited files (ANSI X12 EDI nonsense, to be precise.)

Re: [Tutor] manipulating data

2007-11-07 Thread Bryan Fodness
I also have some information at the beginning of the file and between each field. Is there a way to get the info at the beginning and tell it once it sees Leaf 1A to read the values for the next 120 and then repeat until there are no more Fields. File Rev = G Treatment = Dynamic Dose Last Name =

[Tutor] making a typing speed tester

2007-11-07 Thread Tom
Hi, I asked this question last year but got no response. I'm trying to write a program to test someones typing speed and show them their mistakes. However I'm getting weird results when looking for the differences in longer (than 100 chars) strings: import difflib # a tape measure string (just

Re: [Tutor] In-place expansion of list members... possible?

2007-11-07 Thread Kent Johnson
Marc Tompkins wrote: I'm working with delimited files (ANSI X12 EDI nonsense, to be precise.) First I load the records to a list: tmpSegs = inString.split(self.SegTerm) Now, I want to replace each string in that list with a string: for seg in tmpSegs: # 'seg' is

Re: [Tutor] In-place expansion of list members... possible?

2007-11-07 Thread Marc Tompkins
Try this (untested code): for index in xrange(0, len(tmpSegs)): tmpSegs[index] = tmpSegs[index].split(self.ElemSep) Thank you - that works nicely, and it's a much better replacement for something else I was doing to achieve the same result (you know, the old count+=1 nonsense - every day, in

Re: [Tutor] In-place expansion of list members... possible?

2007-11-07 Thread Marc Tompkins
What puzzles me most is that I can replace 'seg' with just about anything else - for seg in tmpSegs: seg = seg.strip() or for seg in tmpSegs: seg = 'bananas' or for seg in tmpSegs: seg = seg + ' bananas' and it

Re: [Tutor] In-place expansion of list members... possible?

2007-11-07 Thread Eric Brunson
Kent Johnson wrote: Marc Tompkins wrote: I'm working with delimited files (ANSI X12 EDI nonsense, to be precise.) First I load the records to a list: tmpSegs = inString.split(self.SegTerm) Now, I want to replace each string in that list with a string: for seg in

Re: [Tutor] In-place expansion of list members... possible?

2007-11-07 Thread Eric Brunson
John Fouhy wrote: On 08/11/2007, Marc Tompkins [EMAIL PROTECTED] wrote: Now, I did already (intellectually) understand this: A list is an array of pointers to objects, what you've done here is create a new name referencing an item in the list, then making that new name point to

Re: [Tutor] In-place expansion of list members... possible?

2007-11-07 Thread John Fouhy
On 08/11/2007, Marc Tompkins [EMAIL PROTECTED] wrote: Now, I did already (intellectually) understand this: A list is an array of pointers to objects, what you've done here is create a new name referencing an item in the list, then making that new name point to something different. Given

[Tutor] Elegant argument index sort

2007-11-07 Thread Dinesh B Vadhia
I'm sorting a 1-d (NumPy) matrix array (a) and wanting the index results (b). This is what I have: b = a.argsort(0) b = b+1 The one (1) is added to b so that there isn't a zero index element. Is there a more elegant way to do this? Dinesh ___

Re: [Tutor] New Introductory Book

2007-11-07 Thread wesley chun
eddie, Whatever the rationale for the price you could buy 2nd Ed 'Core', Chun *and *3rd edition(when it arrives) 'Learning Python', Lutz (the two standard, known and respected beginners texts) for the price of this. Mmm, I wonder what I would buy or rather have as a student. i've been

Re: [Tutor] repeated times

2007-11-07 Thread Anna Martelli Ravenscroft
I'm not sure if this is what youre asking but if you want to collect all of the output into a file without overwriting, open the output file with a instead of w and the output will. be appended. Iwould suggest in that case that you include info about the user input so you can distinguish

[Tutor] From Numpy Import *

2007-11-07 Thread Michael H. Goldwasser
On Wednesday November 7, 2007, Dinesh B Vadhia wrote: Hello! The standard Python practice for importing modules is, for example: import sys import os etc. In NumPy (and SciPy) the 'book' suggests using: from numpy import * from scipy import *

[Tutor] From Numpy Import *

2007-11-07 Thread Dinesh B Vadhia
Hello! The standard Python practice for importing modules is, for example: import sys import os etc. In NumPy (and SciPy) the 'book' suggests using: from numpy import * from scipy import * However, when I instead use 'import numpy' it causes all sorts of errors in my existing code. What do

Re: [Tutor] From Numpy Import *

2007-11-07 Thread Kent Johnson
Michael H. Goldwasser wrote: from numpy import * import numpy There is a third option which provides the safety/control of import numpy with a little less typing: import numpy as np values = np.array([1.0, 2.0, 3.0]) and you can also import just the names you need: from numpy

Re: [Tutor] repeated times

2007-11-07 Thread linda.s
On 11/4/07, Aditya Lal [EMAIL PROTECTED] wrote: On 11/4/07, Thorsten Kampe [EMAIL PROTECTED] wrote: * linda.s (Sun, 4 Nov 2007 01:39:46 -0800) On Nov 2, 2007 1:03 AM, ALAN GAULD [EMAIL PROTECTED] wrote: I want to run an .exe file and get the output many times. Given that I know