[Tutor] Importing Excel sheet data

2007-09-05 Thread János Juhász
Dear Saradhi, I am using COM on Win32 for this, based on the sample of Mark Hammond & Andy Robinson in the "Programing Python on Win32" book. That is a fairly simple way to do that. The code itself can be downloaded from http://examples.oreilly.com/pythonwin32/ppw32_samples.zip You can find s

[Tutor] unicode encoding hell

2007-09-05 Thread David Bear
I'm using universal feed parser to grab an rss feed. I'm carefull not to use any sys.out, print, file write ops, etc, UNLESS I use a decode('utf-i') to convert the unicode string I get from feed parser to utf-8. However, I'm still getting the blasted decode error stating that one of the items in t

Re: [Tutor] Importing Excel sheet data

2007-09-05 Thread Ian Witham
Hi Saradhi, The first step is to export your excel data to the .csv format. This is done in Excel from the file menu. CSV means "comma separated values". If you have exported the data correctly it may look something like this: "8803","16/9/2007","299000","BEO","13B Mandeville Crescent","Grenada

Re: [Tutor] Importing Excel sheet data

2007-09-05 Thread Ian Witham
HI Saradhi, I too am fairly new to Python, but I use the csv module successfully for my work. Could you be a little more specific as to what your requirements are and where you are finding difficulty? Ian. On 9/6/07, saradhi dinavahi <[EMAIL PROTECTED]> wrote: > > hi Ian , > > I have read the CS

Re: [Tutor] Importing Excel sheet data

2007-09-05 Thread Ian Witham
Hi, You should look at the 'csv' module in the Python Standard Library. If you export your excel data to csv format, you can easily import the data in to python using the csv module. Ian On 9/6/07, saradhi dinavahi <[EMAIL PROTECTED]> wrote: > > hello all, > > I am new to the Python Programming.

[Tutor] Importing Excel sheet data

2007-09-05 Thread saradhi dinavahi
hello all, I am new to the Python Programming. I want to Import Excel sheet data using Python. Can any one please provide me the code and explain the basic steps and method of executing the code. Thank You All ___ Tutor mail

Re: [Tutor] Condensing Some Massive Code

2007-09-05 Thread Kent Johnson
David Millar wrote: > Hello. I'm working on a text adventure game right now, and I seem to be > kind of stuck. There's a huge chunk of code called moreaction() that > pulls scripted events for certain locations. It's ever-changing so I'm > not looking for specifics, but can anyone suggest good w

Re: [Tutor] Metaclass programming

2007-09-05 Thread Kent Johnson
Orest Kozyar wrote: > You're right. I just figured out that for some reason, when I use the > SQLAlchemy mapper() function to map my classes to the corresponding table > object, it seems to affect inspect.getargspec(). > > For example: > > from sqlalchemy.orm import mapper > from sqlalchemy im

Re: [Tutor] Dynamically changing a class

2007-09-05 Thread Kent Johnson
Kent Johnson wrote: > Jason Doege wrote: >> I am building an API and for various reasons I have chosen Python to >> implement it. I'd like to separate the implementation from the interface >> as, for instance, C++ does with separate .hpp and .cpp files. Apart from >> defining a class with a bunch o

Re: [Tutor] more on reading binary... a better way?

2007-09-05 Thread Alan Gauld
"John" <[EMAIL PROTECTED]> wrote > packing it into a dictionary. It works, but somehow doesn't seem so > 'pythonic'. Just seeking comments on how I might make it more > efficient. I don't think its too bad but I'd probably try reading all the data in one go. > #Define Header format > Dfmt=['i

Re: [Tutor] Dynamically changing a class

2007-09-05 Thread Ricardo Aráoz
Kent Johnson wrote: > Ricardo Aráoz wrote: > >> Yep. And once you've got it pls explain it too me, too lazy today to >> pick the manual. :) > > I included a link to my explanation previously. I'm too lazy to try to > do better. > LOL, too tired yesterday to even think straight. Thanks for your

Re: [Tutor] The IF statement

2007-09-05 Thread Kent Johnson
Toby Holland wrote: > Hi gang, > > Just doing what I can to understand as I study > > > I have been reading about testing modules this is the statement that I > have been given > > if __name__ == "__main__": > > > I understand that all modules have a built in attribute __name__, but > what

Re: [Tutor] Condensing Some Massive Code

2007-09-05 Thread Tino Dai
On 9/2/07, David Millar <[EMAIL PROTECTED]> wrote: > > Hello. I'm working on a text adventure game right now, and I seem to be > kind of stuck. There's a huge chunk of code called moreaction() that pulls > scripted events for certain locations. It's ever-changing so I'm not looking > for specifics,

[Tutor] The IF statement

2007-09-05 Thread Toby Holland
Hi gang, Just doing what I can to understand as I study I have been reading about testing modules this is the statement that I have been given if __name__ == "__main__": I understand that all modules have a built in attribute __name__, but what does the __main__ have to do with this attribute

[Tutor] more on reading binary... a better way?

2007-09-05 Thread John
Hello everyone, Here's my solution for reading binary data (unformatted mixed types) and packing it into a dictionary. It works, but somehow doesn't seem so 'pythonic'. Just seeking comments on how I might make it more efficient. Thanks! def readheader(filename): import struct I={0:'rl',1:'ibd

Re: [Tutor] Dynamically changing a class

2007-09-05 Thread Kent Johnson
Jason Doege wrote: > Thanks for the good and useful information on this. Now for the why... > > I am building an API and for various reasons I have chosen Python to > implement it. I'd like to separate the implementation from the interface > as, for instance, C++ does with separate .hpp and .cpp f

Re: [Tutor] Dynamically changing a class

2007-09-05 Thread Jason Doege
Thanks for the good and useful information on this. Now for the why... I am building an API and for various reasons I have chosen Python to implement it. I'd like to separate the implementation from the interface as, for instance, C++ does with separate .hpp and .cpp files. Apart from defining a c

Re: [Tutor] searching a text file

2007-09-05 Thread Kent Johnson
زياد بن عبدالعزيز الباتلي wrote: > Alan Gauld wrote: >> "Diana Hawksworth" <[EMAIL PROTECTED]> wrote >> >>> How do I find a particular name, change the score and then save >>> the changes back to the text file again?? >> iterate over the file checking (and modifying) each line >> write the line bac

Re: [Tutor] Dynamically changing a class

2007-09-05 Thread Kent Johnson
Ricardo Aráoz wrote: > Yep. And once you've got it pls explain it too me, too lazy today to > pick the manual. :) I included a link to my explanation previously. I'm too lazy to try to do better. > Any easier way? Easier how? I don't know what could be easier to implement than a single functi

Re: [Tutor] searching a text file

2007-09-05 Thread زياد بن عبدالعزيز البات لي
Alan Gauld wrote: > "Diana Hawksworth" <[EMAIL PROTECTED]> wrote > >> How do I find a particular name, change the score and then save >> the changes back to the text file again?? > > iterate over the file checking (and modifying) each line > write the line back out: > > Pseudo code > > Out = op

Re: [Tutor] advanced sorting

2007-09-05 Thread Kent Johnson
Alan Gauld wrote: > There is a way to modify sort behaviour in older versions of Python > The docs say: > -- > The sort() method takes an optional argument specifying a > comparison function of two arguments Another way to do this is with the 'Decorate-Sort-Undecorate'

Re: [Tutor] Dynamically changing a class

2007-09-05 Thread Ricardo Aráoz
Alan Gauld wrote: > "Kent Johnson" <[EMAIL PROTECTED]> wrote > >>> Wanted to change the mfunc method but ONLY for an instance, not a >>> class: >> I believe the correct way to do this is to use the __get__() method >> of >> the function object to create a bound method and assign that to the >> i

[Tutor] Drag image

2007-09-05 Thread Ndoe jtki
i want to drag image for my tasks in my college,but i can't understand following example in wx.python 2.6 Docs demo and tool. Have you another simple example for drag image? Thanks - Bergabunglah dengan orang-orang yang berwawasan, di bidang Anda di Yaho

Re: [Tutor] Dynamically changing a class

2007-09-05 Thread Alan Gauld
"Kent Johnson" <[EMAIL PROTECTED]> wrote >> Wanted to change the mfunc method but ONLY for an instance, not a >> class: > > I believe the correct way to do this is to use the __get__() method > of > the function object to create a bound method and assign that to the > instance attribute: Wow!

Re: [Tutor] advanced sorting

2007-09-05 Thread Alan Gauld
"chinni" <[EMAIL PROTECTED]> wrote > i am using a macpro version(10.4.11) and python version is "2.3.5" Thats the problem, you need Python v2.4 to use the key= feature of sort. There is a way to modify sort behaviour in older versions of Python The docs say: -- The s

Re: [Tutor] Problems with wx in Vista...

2007-09-05 Thread Alan Gauld
"Trey Keown" <[EMAIL PROTECTED]> wrote > Although I should have expected at least a few problems, I have a > question > about a glitch in vista using a wx-implemented script. So give us a clue, what is the glitch? > Here's the example script- > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= snipped >

Re: [Tutor] Plz help me from this

2007-09-05 Thread Steve Willoughby
Carlos Daniel Ruvalcaba Valenzuela wrote: > Yes is very possible to do this with python. > > Checkout the os.system and os.popen functions to run external commands > (chmod, chown). While those are ways of calling external commands, it is best to use built-in language features like os.chmod() an