Hi
following last week's discussion with Bob Gailer about reading unformatted
FORTRAN files, I have attached an
example of the file in ASCII format and the equivalent unformatted version.
Below is some code that works OK until
it gets to a data item that has no additional associated data, the
Sorry, still having problems
> > I am trying to read data from a file that has format
> > item_name num_items item_type items
> >
> > eg
> >
> > TIME 1 0.0
> > DISTANCE 10 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0
>
> Where is the item_type?
Ooops, the data format should loo
Hi
I am trying to read data from a file that has format
item_name num_items item_type items
eg
TIME 1 0.0
DISTANCE 10 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0
TIME 1 1.0
DISTANCE 10 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0
I can read this if the data are in ASCII format us
Am trying to convert a C program with a GOTO in it to Python and was wondering
how many loops a Python "break" jumps out of. Here is the C pseudo code
if (test_1) {
for (;;) {
if (test_2) {
do_stuff();
} else if (test_2) {
for (ip=m1+m2+1;ip<=m;ip++) {
Thanks for the various advice(s) re PY2EXE alternatives. I considered
installing Python on the target machines but though it would be simpler to
install the EXE as I has done with C++ apps. Boy, how naive was that? Using
PY2EXE is not straightforward and the documentation is fairly poor IMHO.
Sorry, problem solved
import datetime
import dateutil.relativedelta
x=datetime.date.today()
y=x+datetime.timedelta(days=366)
z=y-x
print x,y,z
a=dateutil.relativedelta.relativedelta(x,y)
print a
seems to do the trick
___
Tutor maillist - Tutor@py
Hi
trying to use dateutil to calculate the number of months between two
dates. here is the script
import datetime
import dateutil
x=datetime.date.today()
y=x+datetime.timedelta(days=366)
z=y-x
print x,y,z
a=dateutil.relativedelta(x,y)
print a
and here is the output
>>>
2006-11-15 2007-11
Hi
just finished developing my first app with wxPython and matplotlib and now
trying to create an EXE file using PY2EXE for distribution. However, this
is proving to be an extremely frustrating experience and I am making very
little progress. Are there any "simple" alternatives to PY2EXE for
Thanks, guys - like so many things, easy when you know how!
Alun Griffiths
At 14:27 27/10/2006, you wrote:
Use this:
if type(a) == type(1):
print "a is int %d"
elif type(a) == type(1.1):
...
HTH..
Regards,
Asrarahmed Kadri
On 10/27/06, Etrade Griffiths
<[EMAIL PROT
Hi
I want to check the type of a variable so that I know which format to use
for printing eg
def print_correct_format(a):
if type(a) == 'int':
print "a is an integer, value %i" % (a)
elif type(a) == 'float':
print "a is a float, value %f" % (a)
Hi
just starting to get to grips with writing GUIs in Python using wxPython and
not being a computer scientist, have a philosophical question about the "best"
way to pass data between various modules. For example, I anticipate having
one module to look after the GUI stuff where users can input
Chris
are you looking for something like this?
xlSht=xlApp.Worksheets("Sheet1")
irow=1
XL_row_has_data=1
while XL_row_has_data:
xlRng=xlSht.Range(xlSht.Cells(irow,1),xlSht.Cells(irow,256))
ncell=xlApp.WorksheetFunction.CountA(xlRng)
if ncell ==0:
# Cells in current row
Thanks for that Kent. I did
imex_exe=r'C:\Program Files\CMG\IMEX\2005.10\EXE\mx200510.exe'
imex_args=('mx200510.exe','-f',imex_fil,'-wd','"'+work_dir+'"')
for n in range(1,nscen):
os.spawnv(os.P_WAIT,
imex_exe, imex_args)
and it seems to work. Not sure why I need to provide the name of
Hi
I am trying to write a PYTHON script that automates the running of an
application program MX200510.EXE under XP Pro via a DOS window. This file
is in directory
C:\Program Files\CMG\IMEX\2005.10\EXE
The command line arguments are
MX200510.EXE -f "temp.dat" -wd "C:\Projects\Vitol\New
busin
Hi
I have a series of python programs that plot stuff using PYX. Common to
these is the need to read in a list of (well) locations in (X,Y) coords so
I put that code in a separate module called shared_funcs.py. The coords
are stored in dictionaries which I want to use later in the "main" prog
/2006, Bob Gailer wrote:
>Etrade Griffiths wrote:
>>Hi
>>
>>I am using the Win32com library to pick up data from an EXCEL spreadsheet
>>but am having trouble with dates. I want to convert a date read from the
>>XL sheet into a float using this snippet
>>
Hi
I am using the Win32com library to pick up data from an EXCEL spreadsheet
but am having trouble with dates. I want to convert a date read from the
XL sheet into a float using this snippet
from win32com.client import dispatch
import time
xlFile="test.xls"
xlApp=Dispatch("Excel.Application")
24/04/06, Etrade Griffiths <[EMAIL PROTECTED]> wrote:
> > Hi
> >
> > just feeling my way into Python with a small app that reads data from
> > file, creates objects using that data, stores the objects in a list, loops
> > over the list doing comparison tests to f
Hi
just feeling my way into Python with a small app that reads data
from file, creates objects using that data, stores the objects in a list,
loops over the list doing comparison tests to filter out various
objects. Here is a code snippet:
class myObj:
def __init__(self,a,b):
self.a
Catherine
I'm a Python newbie too but have done some programming with C++ Builder
so have a little knowledge of GUIs etc
Best regards
Alun
At 22:41 26/01/2006, catherine curley wrote:
Alan
As a matter of interest, did you have much knowledge of Python before you
tried TKinter? I'm only a pyth
Hi!
Just started trying to get to grips with Python and Tkinter. Have Frederick
Lundh's tutorial and am on program hello2.py which looks like this
# File: hello2.py
from Tkinter import *
class App:
def __init__(self, master):
frame = Frame(master)
frame.pack()
s
21 matches
Mail list logo