Re: [Tutor] Re: Could I have used time or datetime modules here?

2004-12-08 Thread Brian van den Broek
Brian van den Broek said unto the world upon 2004-12-07 23:57: Dick Moores said unto the world upon 2004-12-07 12:04: The note you reference: date2 is moved forward in time if timedelta.days > 0, or backward if timedelta.days < 0. Afterward date2 - date1 == timedelta.days. timedelta.seconds and

Re: [Tutor] Please help matching elements from two lists and printing them

2004-12-08 Thread kumar s
Hi, thank you very much for suggesting a way. In fact I tried and I found another way to do it. could you please suggest if something is wrong because I have false positive results in the output. That means I getting more that the values I have in spot_cor. For example I have 2500 elements in

Re: [Tutor] Vpython

2004-12-08 Thread Guillermo Fernandez Castellanos
Hi, On the Vpython homepage they have links to quite a few programs: http://vpython.org/contributed.html http://www.physics.syr.edu/%7Esalgado/software/vpython/ Should be enough for a start. Enjoy, Guille On Wed, 8 Dec 2004 22:05:31 -0500 (GMT-05:00), [EMAIL PROTECTED] <[EMAIL PROTECTED]> wro

[Tutor] Vpython

2004-12-08 Thread bigpimpin10451
I was wondering were can I find some Vpython graphics program codes that are readily available. ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Simple RPN calculator

2004-12-08 Thread Bob Gailer
At 06:05 AM 12/6/2004, you wrote: Bob Gailer wrote: > For grins I just wrote one that takes '1 2.3 - 3 4 5 + * /' as input > and prints -0.0481481 8 lines of Python. That indeed is less than > 100. Took about 7 minutes to code and test. I'm quite interested in seeing the sourcecode for that. I'

Re: [Tutor] MemoryError

2004-12-08 Thread Jeff Shannon
Liam Clarke wrote: I'm not sure why you're getting the MemoryError, but it'd be easier to figure out if you posted the entire text of the traceback. Traceback: Line 39: seg=codeSt[element:endInd+len(endStr] MemoryError Hehe. Helpful, no? Actually, it was the "usual bit about in module" that might

Re: [Tutor] MemoryError

2004-12-08 Thread Alan Gauld
> Traceback: > > Line 39: seg=codeSt[element:endInd+len(endStr] > MemoryError > > Hehe. Helpful, no? Sometimes seeing the whole traceback gives clues as to whats throwing the wobbly, without the full stack its hard to tell. However before worrying about that I'd add a print statement to pri

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-08 Thread Alan Gauld
> Note that SOME languages use () for call. There are other call constructs, > such as: > > DO function WITH parameters (FoxPro, similar in COBOL) > > function parameter or parameter1 function parameter2 (APL) And in Smalltalk: object message: parameter1 : parameter2 : parameter3 Or as an ex

Re: [Tutor] Please help matching elements from two lists and printing them

2004-12-08 Thread Bob Gailer
At 02:51 PM 12/8/2004, kumar s wrote: Dear group, I have two tables: First table: spot_cor: 432 117 499 631 10 0 326 83 62 197 0 0 37 551 Second table: spot_int 0 0 98 1 0 5470 2 0 113 3 0 5240 4 0 82.5 5

Re: [Tutor] MemoryError

2004-12-08 Thread Liam Clarke
> I'm not sure why you're getting the MemoryError, but it'd be easier to > figure out if you posted the entire text of the traceback. Traceback: Line 39: seg=codeSt[element:endInd+len(endStr] MemoryError Hehe. Helpful, no? I think I'll sprinkle print statements throughout as suggested, and wr

Re: [Tutor] MemoryError

2004-12-08 Thread Liam Clarke
Oh, and I never knew about .read() for a file object. I always just used readline/readlines. Silly, really. On Thu, 9 Dec 2004 11:31:40 +1300, Liam Clarke <[EMAIL PROTECTED]> wrote: > > I'm not sure why you're getting the MemoryError, but it'd be easier to > > figure out if you posted the entire

[Tutor] Please help matching elements from two lists and printing them

2004-12-08 Thread kumar s
Dear group, I have two tables: First table: spot_cor: 432 117 499 631 10 0 326 83 62 197 0 0 37 551 Second table: spot_int 0 0 98 1 0 5470 2 0 113 3 0 5240

Re: [Tutor] Removing/Handing large blocks of text

2004-12-08 Thread Alan Gauld
> I'm trying to do this with the re module - the two tags looks like: > > > ... > a bunch of text (~1500 lines) > ... > > > I need to identify the first tag, and the second, and unconditionally > strip out everything in between those two tags, making it look like: > > > A very simp

Re: [Tutor] MemoryError

2004-12-08 Thread Jeff Shannon
Liam Clarke wrote: Hi all, I'm playing with a file, and attempting to replace a section with a string, and using the following command - seg=codeSt[element:endInd+len(endStr] codeSt=codeSt.replace(seg, hrefString) At the replace, I get a MemoryError. It's part of a for loop, but it gives the erro

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-08 Thread Bob Gailer
At 12:39 PM 12/8/2004, Bob Gailer wrote: At 11:27 AM 12/8/2004, Dick Moores wrote: My thanks to both Max and Kent. So Python tries, and fails, to see 2() as a function! I also got some help from Note that SOME languages use () for call. There are othe

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-08 Thread Bob Gailer
At 11:27 AM 12/8/2004, Dick Moores wrote: My thanks to both Max and Kent. So Python tries, and fails, to see 2() as a function! I also got some help from Note that SOME languages use () for call. There are other call constructs, such as: DO function

Re: [Tutor] Simple RPN calculator

2004-12-08 Thread Gregor Lingl
Terry Carroll schrieb: On Mon, 6 Dec 2004, Chad Crabtree wrote: Bob Gailer wrote: For grins I just wrote one that takes '1 2.3 - 3 4 5 + * /' as input and prints -0.0481481 8 lines of Python. That indeed is less than 100. Took about 7 minutes to code and test.

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-08 Thread Dick Moores
My thanks to both Max and Kent. So Python tries, and fails, to see 2() as a function! I also got some help from Dick ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor

[Tutor] Another ? on large text files

2004-12-08 Thread Kooser, Ara S
I have a large file (4.1 MB, 2600 pgs) of simulated power spectrums. The problem is that there are 6 separated files all combined into this large file. I know how to read the file in and then remove the header information but how would I go about separating the 6 sections into separate files? The

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-08 Thread Kent Johnson
A callable is something that can be called with functional notation. It can be a function, a class, or in some cases a class instance. In general, any object that has a __call__() special method is callable. The callable() built-in tells you if an object is callable, though you can also just try

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-08 Thread Max Noel
On Dec 8, 2004, at 17:01, Dick Moores wrote: I got this error msg for this line of code: n = -(2(a**3.0)/27.0 - a*b/3.0 + c) (where a = 1, b = 2, c = 3) And was baffled until I realized the line should be n = -(2*(a**3.0)/27.0 - a*b/3.0 + c) But I still don't understand what "callable" means. Can s

[Tutor] "TypeError: 'int' object is not callable"??

2004-12-08 Thread Dick Moores
I got this error msg for this line of code: n = -(2(a**3.0)/27.0 - a*b/3.0 + c) (where a = 1, b = 2, c = 3) And was baffled until I realized the line should be n = -(2*(a**3.0)/27.0 - a*b/3.0 + c) But I still don't understand what "callable" means. Can someone help? Thanks, Dick Moores [EMAIL PROTE

Re: [Tutor] Removing/Handing large blocks of text

2004-12-08 Thread Kent Johnson
I would use a loop with a flag to indicate whether you are in the block or not. If the tags are always and on a line by themselves you don't need an re: lines = [] appending = True f = open('foobar.txt', 'r') for line in f: if appending: lines.append(line) if line.strip() == '':

Re: [Tutor] Removing/Handing large blocks of text

2004-12-08 Thread Max Noel
On Dec 8, 2004, at 14:42, Jesse Noller wrote: Hello, I'm trying to do some text processing with python on a farily large text file (actually, XML, but I am handling it as plaintext as all I need to do is find/replace/move) and I am having problems with trying to identify two lines in the text file,

[Tutor] Removing/Handing large blocks of text

2004-12-08 Thread Jesse Noller
Hello, I'm trying to do some text processing with python on a farily large text file (actually, XML, but I am handling it as plaintext as all I need to do is find/replace/move) and I am having problems with trying to identify two lines in the text file, and remove everything in between those two l

Re: [Tutor] MemoryError

2004-12-08 Thread Michael Janssen
[forgot to cc to the list] -- Forwarded message -- From: Michael Janssen <[EMAIL PROTECTED]> Date: Wed, 8 Dec 2004 14:40:46 +0100 Subject: Re: [Tutor] MemoryError To: Liam Clarke <[EMAIL PROTECTED]> On Wed, 8 Dec 2004 23:29:38 +1300, Liam Clarke <[EMAIL PROTECTED]> wrote: > I'm

[Tutor] MemoryError

2004-12-08 Thread Liam Clarke
Hi all, I'm playing with a file, and attempting to replace a section with a string, and using the following command - seg=codeSt[element:endInd+len(endStr] codeSt=codeSt.replace(seg, hrefString) At the replace, I get a MemoryError. It's part of a for loop, but it gives the error the first time