[Tutor] Interactive physics simulation over web

2008-04-04 Thread Brain Stormer
I am working on a physics simulation and would like to publish it on the web. The simulation requires input fields, mouse action (picking points in a display pane) and movie like feature with play, pause, skip forward and skip backward. I was wondering if this can be done using Python and a Pytho

[Tutor] input and output files from terminal

2008-04-14 Thread Brain Stormer
I have a python program which works fine when run using idle but I would like call the program from the terminal. python test.py -i inputfile -o outputfile I tried with raw_input but that only works in idle. Can this be achieved? Thanks ___ Tutor maill

Re: [Tutor] input and output files from terminal

2008-04-14 Thread Brain Stormer
ting" sys.exit() elif os.path.isfile(options.outfile): print "Output file exists, Remove it first" sys.exit() Thanks everyone. On Mon, Apr 14, 2008 at 1:14 PM, <[EMAIL PROTECTED]> wrote: > look at the OptParse module, with this u can easily realize such things. > http

Re: [Tutor] input and output files from terminal

2008-04-17 Thread Brain Stormer
e files so I can use it inside my program. On Mon, Apr 14, 2008 at 2:57 PM, Alan Gauld <[EMAIL PROTECTED]> wrote: > > "Brain Stormer" <[EMAIL PROTECTED]> wrote > > >I have a python program which works fine when run using idle but I > >would > > like

[Tutor] How to skip to next line in for loop

2008-05-01 Thread Brain Stormer
I have the following code: f = open('file.txt',r) for line in f.read(): if line == "3": line.next print line f.close() The file.txt looks like 1 2 3 4 5 I would like the code to output "4" but I don't know how to use the next. Are there any other way? Thanks ___

Re: [Tutor] How to skip to next line in for loop

2008-05-02 Thread Brain Stormer
MAIL PROTECTED]> wrote: > > > Shouldn't it even be 'line = f.next()'? > > Wow, I think Brain Stormer should get a prize. I'm not sure what the > prize is, but his short program has elicited incomplete and inaccurate > answers from three of the top posters t

Re: [Tutor] How to skip to next line in for loop

2008-05-02 Thread Brain Stormer
You are correct. It is missing the ":" and it will print "3" On Fri, May 2, 2008 at 10:18 AM, bob gailer <[EMAIL PROTECTED]> wrote: > Brain Stormer wrote: > > > Well, > > I was somewhat confused with all of the answers so I decided to go with > >

Re: [Tutor] How to skip to next line in for loop

2008-05-02 Thread Brain Stormer
f=open('file.txt',r) position =False for line in f.read().split(): if position == True print line position = False if line == "3": position = True else: position = False f.close() On Fri, May 2, 2008 at 10:28 AM, Brain Storm

[Tutor] Array filling

2008-07-03 Thread Brain Stormer
I am using numpy to create an array then filling some of the values using a for loop, I was wondering if there is way to easily fill the values without iterating through sort of like "array.fill[start:stop,start:stop]"? The reason for my question is, in some cases, I might have to fill hundreds (w