Re: [Tutor] How to use __iter__

2011-08-08 Thread Peter Otten
Jia-Yu Aw wrote: > How to use __iter__ > Von: > Jia-Yu Aw > Antwortadresse: > Jia-Yu Aw > Datum: > Dienstag, 9. August 2011 03:48:20 > An: > tutor@python.org > Gruppen: > gmane.comp.python.tutor > Hi all > > I've been learning Classes and have read the documentation on __iter__ but st

Re: [Tutor] Missing in web.py and nosetests

2011-08-08 Thread 李龑
Thanks again. I add "print os.getcwd()" inside* app.py* and *app_test.py(the nosetests script) *and find they are different. In app.py, the working dir is the whole directory including all subdirectories, but in app_test.py the working dir is the tests directory only. I guess it's due to the work

[Tutor] How to use __iter__

2011-08-08 Thread Jia-Yu Aw
Hi all I've been learning Classes and have read the documentation on __iter__ but still don't understand how it works. I have two pieces of code: the first is def __iter__, the second is using __iter__. Instead of being an iterator, I'm just using this is a function, which I think is incorrect.

[Tutor] Reprojection tool for vector datasets

2011-08-08 Thread Helen Brown
I am such a novice at this but I have gotten to a place where I am stuck. The attachment is what I have done so far but it also has an error for indentation. I will be working on that to. I have place comment as to what I want the modules to do but that is as far as I can go. Can someone lead me

Re: [Tutor] Missing in web.py and nosetests

2011-08-08 Thread Steven D'Aprano
李龑 wrote: Thanks Steven. Sorry for trying to discuss nose or templates here :( No need to be sorry, it isn't forbidden, but you may have more success asking help elsewhere. Do you actually have a template called "hello_form"? If not, then my *guess* is that this is an *error* (even though

Re: [Tutor] Missing in web.py and nosetests

2011-08-08 Thread 李龑
Thanks Steven. Sorry for trying to discuss nose or templates here :( Do you actually have a template called "hello_form"? If not, then my *guess* > is that this is an *error* (even though it prints F) because you don't > actually have a template called hello_form. Yes, I have this template, and

Re: [Tutor] gzip

2011-08-08 Thread questions anon
Thank you and I will look into shutils, below is the code that did work: import gzip import os MainFolder=r"E:/data" for (path, dirs, files) in os.walk(MainFolder): for dir in dirs: print dir path=path+'/' for gzfiles in files: if gzfiles[-3:]=='.gz': pri

Re: [Tutor] Missing in web.py and nosetests

2011-08-08 Thread Steven D'Aprano
李龑 wrote: Hi all, I'm new in python and is learning about testing my little web.py app with nosetests. When the app is running in the web browser, it's ok. And the terminal returns something like "127.0.0.1:51936 - - [08/Aug/2011 23:00:37] "HTTP/1.1 GET /hello" - 200 OK" But when I'm trying to

Re: [Tutor] How to get the keys of a dict inside a dict. ValueError: too many values to unpack

2011-08-08 Thread Prasad, Ramit
>I would suggest using the string format() method to lay out the columns >as you want them. You could use tab, but if your data values vary much, >you'll get inconsistent results (i.e., if one row's value goes past the >next tab stop). You'll want to create your own for loop to iterate over >

[Tutor] Missing in web.py and nosetests

2011-08-08 Thread 李龑
Hi all, I'm new in python and is learning about testing my little web.py app with nosetests. When the app is running in the web browser, it's ok. And the terminal returns something like "127.0.0.1:51936 - - [08/Aug/2011 23:00:37] "HTTP/1.1 GET /hello" - 200 OK" But when I'm trying to test the ap

Re: [Tutor] How to get the keys of a dict inside a dict. ValueError: too many values to unpack

2011-08-08 Thread Steve Willoughby
On 08-Aug-11 02:20, Kayode Odeyemi wrote: Either way, once you have the list of the keys you want to display, print them out once as column headings My concern is how do I print them out as columns, since writer.writerows is currently lining them out as rows (\n) Is there a function ava

Re: [Tutor] "Object designer" applications - are there any?

2011-08-08 Thread Flynn, Stephen (L & P - IT)
Yup - sounds more like what the final version of my little project will do. At the moment, I'm more interested in taking each specific database's version of it's DDL and converting it to an Oracle version of that DDL, so initially it's not much more than a text converter which reads in text de

Re: [Tutor] How to get the keys of a dict inside a dict. ValueError: too many values to unpack

2011-08-08 Thread Kayode Odeyemi
> > Either way, once you have the list of the keys you want to display, print > them out once as column headings My concern is how do I print them out as columns, since writer.writerows is currently lining them out as rows (\n) Is there a function available for me to do this or do I have to const

Re: [Tutor] How to get the keys of a dict inside a dict. ValueError: too many values to unpack

2011-08-08 Thread Steve Willoughby
On 08-Aug-11 01:18, Kayode Odeyemi wrote: Thanks so much. This is exactly what I'm looking for. In addition, since fields is obviously a dict, I won't want to have to display it's keys repeatedly. Is there a way to get the keys once, have it displayed and used as columns, then it's values are dis

Re: [Tutor] gzip

2011-08-08 Thread Stefan Behnel
questions anon, 08.08.2011 01:57: Thank you, I didn't realise that was all I needed. Moving on to the next problem: I would like to loop through a number of directories and decompress each *.gz file and leave them in the same folder but the code I have written only seems to focus on the last fold

Re: [Tutor] How to get the keys of a dict inside a dict. ValueError: too many values to unpack

2011-08-08 Thread Kayode Odeyemi
Thanks so much. This is exactly what I'm looking for. In addition, since fields is obviously a dict, I won't want to have to display it's keys repeatedly. Is there a way to get the keys once, have it displayed and used as columns, then it's values are displayed beneath it. Something like: updated