Re: [Tutor] how to read from a txt file

2005-02-17 Thread Brian van den Broek
jrlen balane said unto the world upon 2005-02-17 02:41: sir, what seemed to be the problem with this: def process(list_of_lines): data_points = [] for line in list_of_lines: data_points.append(int(line)) return data_points data_file = open('C:/Documents and

[Tutor] Re: Active Python

2005-02-17 Thread Andrei
Robert Campbell rcx at mchsi.com writes: I am not a programmer, but have decided to learn Python. I am wondering if anyone has used the Activestate ActivePython and what are the advantages/disadvantages of using it rather than the standard Python tools. I use it, but I haven't used an

Re: [Tutor] how to read from a txt file

2005-02-17 Thread Brian van den Broek
Brian van den Broek said unto the world upon 2005-02-17 03:51: jrlen balane said unto the world upon 2005-02-17 02:41: sir, what seemed to be the problem with this: SNIP Hi, I think the traceback is my fault from an oversight in the code I sent you when you posted before. Sorry about that :-[

[Tutor] Re: how to read from a txt file

2005-02-17 Thread Wolfram Kraus
Brian van den Broek wrote: jrlen balane said unto the world upon 2005-02-17 02:41: [...] data_file = open('C:/Documents and Settings/nyer/Desktop/nyer.txt', 'r') [...] The immediate one, due to my advice, is that each line of your file ends with a newline character ('\n'). So, you cannot call int

Re: [Tutor] how to read from a txt file

2005-02-17 Thread Brian van den Broek
Brian van den Broek said unto the world upon 2005-02-17 03:51: jrlen balane said unto the world upon 2005-02-17 02:41: sir, what seemed to be the problem with this: def process(list_of_lines): data_points = [] for line in list_of_lines: data_points.append(int(line)) return

Re: [Tutor] how to read from a txt file

2005-02-17 Thread Danny Yoo
Traceback (most recent call last): File C:\Python23\practices\opentxt, line 12, in -toplevel- process(data) File C:\Python23\practices\opentxt, line 6, in process data_points.append(int(line)) ValueError: invalid literal for int(): Hi Brian, Ah, think about empty

Re: [Tutor] how to read from a txt file

2005-02-17 Thread Gregor Lingl
Brian van den Broek schrieb: Brian van den Broek said unto the world upon 2005-02-17 03:51: jrlen balane said unto the world upon 2005-02-17 02:41: sir, what seemed to be the problem with this: def process(list_of_lines): data_points = [] for line in list_of_lines:

[Tutor] RE:

2005-02-17 Thread Gopinath V, ASDC Chennai
Title: RE: robert wrote Message: 1 Date: Wed, 16 Feb 2005 21:49:14 -0600 From: Robert Campbell [EMAIL PROTECTED] Subject: [Tutor] Active Python To: tutor@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=iso-8859-1 Hi, I am not a programmer, but have

[Tutor] (no subject)

2005-02-17 Thread Kevin Hine
Hello I'm very new to python but need to write a script to update a single geodatabase table in arcview9 from several dbf files. If I can do this I can then use windows scheduled tasks to up date the tables automatically. The field names in the dbs files are or can be slightly different from

[Tutor] Help needed with script to batch-create shapefiles

2005-02-17 Thread Chris Bromley
Hello again, First off, please accept my apologies for my last message, which was sorely lacking in the detail department. I'm such a beginner with programming that I assumed the error would be glaringly obvious to an experienced programmer and would jump of the page/screen right away. This

Re: [Tutor] (no subject)

2005-02-17 Thread Kent Johnson
Kevin Hine wrote: Hello I'm very new to python but need to write a script to update a single geodatabase table in arcview9 from several dbf files. If I can do this I can then use windows scheduled tasks to up date the tables automatically. The field names in the dbs files are or can be slightly

Re: [Tutor] Help needed with script to batch-create shapefiles

2005-02-17 Thread Brian van den Broek
Chris Bromley said unto the world upon 2005-02-17 11:05: SNIP Prior to running the script I use the ‘check’ button in the PythonWin and the script’s syntax is fine. When I run the script though, the message ‘Script ‘C:\ dBase_File_To_Shapefile.py’ returned exit code 0’ appears in the status bar at

Re: ****SPAM(11.2)**** [Tutor] Larger program organization

2005-02-17 Thread Bob Gailer
At 03:04 PM 2/16/2005, Brian van den Broek wrote: Terry Carroll said unto the world upon 2005-02-16 16:18: On Fri, 11 Feb 2005, Bob Gailer wrote: Whenever you find yourself writing an if statement ask whether this would be better handled by subclasses. Whenever you find yourself about to write a

Re: [Tutor] elementtree, lists, and dictionaries

2005-02-17 Thread Luis N
Thanks that's much nicer. On Fri, 11 Feb 2005 22:28:55 -0500, Kent Johnson [EMAIL PROTECTED] wrote: If you iterate over the author nodes you can check the user name and password of each in turn. Not tested code! def authenticateAuthor(author, password): authorxml = 'author.xml'

[Tutor] Class in a class

2005-02-17 Thread Luis N
Does it make sense to do this: In [2]: class AB: ...: pass ...: In [3]: a = AB() In [4]: a Out[4]: __main__.AB instance at 0x8428bec In [5]: class BC: ...: def __init__(self, foo): ...: self.foo = foo In [6]: b = BC(a) In [7]: b.foo Out[7]: __main__.AB instance at

[Tutor] Problem in making calulator

2005-02-17 Thread . Sm0kin'_Bull
No-one answered question So, I e-mail it again Help me please I wrote this to add 2 numbers... print Please input data number1 = int(raw_input( )) number2 = int(raw_input(+ )) total = number1 + number2 print total raw_input() I want to make output like this... 1 + 1 = 2 But, actually... it looks

Re: [Tutor] Class in a class

2005-02-17 Thread Kent Johnson
Luis N wrote: Does it make sense to do this: In [2]: class AB: ...: pass ...: In [3]: a = AB() In [4]: a Out[4]: __main__.AB instance at 0x8428bec In [5]: class BC: ...: def __init__(self, foo): ...: self.foo = foo In [6]: b = BC(a) In [7]: b.foo Out[7]: __main__.AB

Re: [Tutor] Class in a class

2005-02-17 Thread Alan Gauld
Does it make sense to do this: That depends on what you are trying to do! If its to make scrambled eggs thewn nope, no sense whatsoever, but if writing a programme storing an instance inside another instance is very common indeed! :-) In [2]: class AB: ...: pass ...: In [3]: a

Re: [Tutor] Class in a class

2005-02-17 Thread Liam Clarke
Hi Kent, So the layering is GUI - user interaction Application functionality CbDao - application-specific database access DbAccess - generic database access, easy to use JDBC connection - raw database access, not so easy to use This sounds a lot like what I'm aiming for in a project, the

[Tutor] help with HTMLParseError

2005-02-17 Thread Peter Kim
I'm using HTMLParser.py to parse XHTML and invalid tag is throwing an exception. How do I handle this? 1. Below is the faulty markup. Notice the missing . Both Firefox and IE6 correct automatically but HTMLParser is less forgiving. My code has to be able to treat this gracefully because I

Re: [Tutor] Active Python

2005-02-17 Thread Jeff Shannon
On Thu, 17 Feb 2005 15:54:43 -0800 (PST), Terry Carroll [EMAIL PROTECTED] wrote: On Wed, 16 Feb 2005, Robert Campbell wrote: I am not a programmer, but have decided to learn Python. I am wondering if anyone has used the Activestate ActivePython and what are the advantages/disadvantages