Re: [Tutor] calling subroutines into program

2005-02-08 Thread Jacob S.
Liam Clarke wrote: oh? Is is the negative? No, the decimal fraction. It's easy enough to try it: Not exactly, it's a combination of string *and* decimal fraction. int('-945') -945 int('-945.0') Traceback (most recent call last): File "", line 1, in ? ValueError: invalid literal for int(): -945.0 i

Re: [Tutor] calling subroutines into program

2005-02-07 Thread Kent Johnson
Liam Clarke wrote: oh? Is is the negative? No, the decimal fraction. It's easy enough to try it: >>> int('950') 950 >>> int('-950') -950 >>> int('950.00') Traceback (most recent call last): File "", line 1, in ? ValueError: invalid literal for int(): 950.00 >>> int('-950.00') Traceback (most

Re: [Tutor] calling subroutines into program

2005-02-07 Thread Liam Clarke
oh? Is is the negative? On Mon, 07 Feb 2005 09:36:02 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > Liam Clarke wrote: > >>>example of (1): > >>>- > >>>#this part of the program reads the file basin.out (the data we want to > >>>analyze) a

Re: [Tutor] calling subroutines into program

2005-02-07 Thread Kent Johnson
Liam Clarke wrote: example of (1): - #this part of the program reads the file basin.out (the data we want to analyze) and changes its contents to the array arr_xy #layout of basin.out: #1 -950.0010.00 200> this line contains start

Re: [Tutor] calling subroutines into program

2005-02-07 Thread Kent Johnson
Karen, Put all of your code into a function, maybe called import_cobra(). The function should take the path to the basic.out file as a parameter and return the array of data. So it will look something like this: def import_cobra(basicPath): cobra_xy_file = open(basicPath) # All the same c

Re: [Tutor] calling subroutines into program

2005-02-07 Thread Liam Clarke
Actually, if I may rewrite some sections of your code - > > example of (1): > > - > > #this part of the program reads the file basin.out (the data we want to > > analyze) and changes its contents to the array arr_xy > > #layout of basin.out:

Re: [Tutor] calling subroutines into program

2005-02-07 Thread Liam Clarke
Hi Karen, if I have a file called foo.py = def la() return "la" x = 15 I can do the following in bar.py = import foo#Notice there's no .py extension! j = foo.la() print j print foo.x > la > 15 Hope that helps Liam Clarke On Mon, 07 Feb 2005 14:40:06 +0100, Karen Leever <[EMAIL P

[Tutor] calling subroutines into program

2005-02-07 Thread Karen Leever
Hello, I've been writing some small python programs that basically do function analysis on the (x,y) output of a fortran code called COBRA. The COBRA output (basin.out) is the shape of a flexed beam, of which I calculate the 0-crossing, x and y of max. amplitude, and cross sectional area between