Re: [Tutor] WRITING XLS FROM OS.WALK()

2010-10-08 Thread David Hutto
Here's a little 'anomaly' though, programmers say hammer when the truth is, that modern construction should use pneumatic tools, as in air hammer. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.or

[Tutor] Interpolation

2010-10-08 Thread David Hutto
Maybe I missed it, even in the google searches/manuals, but does someone know of an introduction to python interpolation that show the different forms of % , as in %s = string, and %d = digit(i think, or correct me). TIA, David ___ Tutor maillist - Tut

Re: [Tutor] WRITING XLS FROM OS.WALK()

2010-10-08 Thread David Hutto
On Sat, Oct 9, 2010 at 2:12 AM, Steven D'Aprano wrote: > On Sat, 9 Oct 2010 03:15:35 pm you wrote: > >> > You should use that. It works, it is tested and thoroughly >> > debugged, and it is powerful. >> >> Certainly so, but not as powerful as the individual's ingenuity in >> solving the problem at

Re: [Tutor] WRITING XLS FROM OS.WALK()

2010-10-08 Thread Steven D'Aprano
On Sat, 9 Oct 2010 03:15:35 pm you wrote: > > You should use that. It works, it is tested and thoroughly > > debugged, and it is powerful. > > Certainly so, but not as powerful as the individual's ingenuity in > solving the problem at hand without foreknowledge of the 'known' > solution. I suppos

Re: [Tutor] WRITING XLS FROM OS.WALK()

2010-10-08 Thread David Hutto
On Fri, Oct 8, 2010 at 11:55 PM, Steven D'Aprano wrote: > On Sat, 9 Oct 2010 06:34:44 am Susana Iraiis Delgado Rodriguez wrote: >> Hello members: >> I developed a Python module to make a list which contains all the >> files ending with .shp and .dbf extensions, I have solved this >> already, > > >

Re: [Tutor] WRITING XLS FROM OS.WALK()

2010-10-08 Thread Steven D'Aprano
On Sat, 9 Oct 2010 06:34:44 am Susana Iraiis Delgado Rodriguez wrote: > Hello members: > I developed a Python module to make a list which contains all the > files ending with .shp and .dbf extensions, I have solved this > already, I'm sorry to tell you that you've just reinvented the wheel. This

Re: [Tutor] WRITING XLS FROM OS.WALK()

2010-10-08 Thread Hilton Fernandes
Hi ! Being Python as rich in libraries, probably there's already a library to create .XLS files. Before finding that, you can try the CSV format: simply put a comma to separate any fields you want in your values. And of course, a comma will finish your line. That way, Excel or any other spreads

Re: [Tutor] WRITING XLS FROM OS.WALK()

2010-10-08 Thread Emile van Sebille
On 10/8/2010 12:34 PM Susana Iraiis Delgado Rodriguez said... Hello members: I developed a Python module to make a list which contains all the files ending with .shp and .dbf extensions, I have solved this already, but now I want to write an excel file from it. The file should show the full path

Re: [Tutor] Rounding a Python float to the nearest half integer

2010-10-08 Thread Wayne Werner
On Fri, Oct 8, 2010 at 7:58 AM, Sithembewena Lloyd Dube wrote: > I realise that one cannot have a half integer :) I meant how would one > round off to the first decimal nearest to either 0.5, or a whole number. > > Ugh...does anyone get what I'm trying to articulate? :) sample input/output cases

Re: [Tutor] WRITING XLS FROM OS.WALK()

2010-10-08 Thread Walter Prins
On 8 October 2010 20:34, Susana Iraiis Delgado Rodriguez < susana.delgad...@utzmg.edu.mx> wrote: > Hello members: > I developed a Python module to make a list which contains all the files > ending with .shp and .dbf extensions, I have solved this already, but now I > want to write an excel file fr

[Tutor] WRITING XLS FROM OS.WALK()

2010-10-08 Thread Susana Iraiis Delgado Rodriguez
Hello members: I developed a Python module to make a list which contains all the files ending with .shp and .dbf extensions, I have solved this already, but now I want to write an excel file from it. The file should show the full path from the found files. This is the code: import os a = open ("di

Re: [Tutor] IDE for Python

2010-10-08 Thread Steven D'Aprano
On Fri, 8 Oct 2010 02:23:27 am Juan Jose Del Toro wrote: > Dear List; > > In your experience what is the best IDE for Python? None of them. I use a good editor in one window (I prefer Kate for larger projects, although Kwrite is good enough for single modules or scripts) and a good xterm in an

Re: [Tutor] FW: list of dict question

2010-10-08 Thread Francesco Loffredo
On 08/10/2010 16.54, Roelof Wobben wrote: ... Hello Franceso, Thank you for the answer. You're welcome. Now find ot how i can find the dict which contains a team. I thinking now of something like this. teller = 1 For wedstrijd in tournooi : if wedstrijd['thuis'] != stand ['ploeg'] :

Re: [Tutor] PYTHON QUOTES ISSUE

2010-10-08 Thread taserian
On Fri, Oct 8, 2010 at 10:27 AM, Susana Iraiis Delgado Rodriguez < susana.delgad...@utzmg.edu.mx> wrote: > Hi Alan: > > The ouput is coming from a cicle and some functions that I vae to do to > execute an ogr2ogr command, in this output I ask the user for the name of a > file and then make a modul

Re: [Tutor] Non-ASCII

2010-10-08 Thread Shawn Matlock
Evert, You're guess was right, copying the code from the email message worked. My IDE - Eclipse/PyDev - must have been hiding the control character. I had tried copying my code out to a text editor and back before asking for help, but it didn't work. Perhaps I didn't "select all" before pasting

[Tutor] FW: list of dict question

2010-10-08 Thread Roelof Wobben
> From: rwob...@hotmail.com > To: f...@libero.it > Subject: RE: [Tutor] list of dict question > Date: Fri, 8 Oct 2010 14:53:53 + > > > > > > Date: Fri, 8 Oct 2010 13:40:04 +0200 > From: f...@libero.it > To: tut

Re: [Tutor] Rounding a Python float to the nearest half integer

2010-10-08 Thread Evert Rol
> @Evert, I didn't figure out that your response was a solution, thought it was > a question. Must be coffee time :P > > I tried it and, for instance, the rounded value (9) / 2 gave me 4.0 Couldn't > get it until I noticed that @Joel divided the roudned figure by a decimal > 2.0. That gave 4.5,

Re: [Tutor] PYTHON QUOTES ISSUE

2010-10-08 Thread Susana Iraiis Delgado Rodriguez
Besides, If I print the query, I have the next output: C:/Archivos de programa/FWTools2.4.7/bin/ogr2ogr U3B-BARDA .shp -where "LAYER='U3B-BARDA '" tapalpa_05_plani_line.shp C:/Archivos de programa/FWTools2.4.7/bin/ogr2ogr N2H-TEMP .shp -where "LAYER='N2H-TEMP '" tapalpa_05_plani_line.shp C:/

Re: [Tutor] PYTHON QUOTES ISSUE

2010-10-08 Thread Susana Iraiis Delgado Rodriguez
Hi Alan: The ouput is coming from a cicle and some functions that I vae to do to execute an ogr2ogr command, in this output I ask the user for the name of a file and then make a module to get to the subprocess part: import shlex, subprocess, sys from dbf import * def process(): #Read dbfile statu

Re: [Tutor] Rounding a Python float to the nearest half integer

2010-10-08 Thread Sithembewena Lloyd Dube
@Evert, I didn't figure out that your response was a solution, thought it was a question. Must be coffee time :P I tried it and, for instance, the rounded value (9) / 2 gave me 4.0 Couldn't get it until I noticed that @Joel divided the roudned figure by a decimal 2.0. That gave 4.5, which is what

Re: [Tutor] Rounding a Python float to the nearest half integer

2010-10-08 Thread Sithembewena Lloyd Dube
Thanks everyone, I need to round to the nearest half (finally occured). Made some chnages to Wayne's code as follows: x = 4.4348 if x % 1 >= 0.5: round(x) # gives 5.0 if the the value of the expression x % 1 exceeds 0.5 else: x = round(x) + 0.5 # gives 4.5, as in this case. Many thanks!

Re: [Tutor] Rounding a Python float to the nearest half integer

2010-10-08 Thread Joel Goldstick
On Fri, Oct 8, 2010 at 9:00 AM, Evert Rol wrote: > > I realise that one cannot have a half integer :) I meant how would one > round off to the first decimal nearest to either 0.5, or a whole number. > > > > Ugh...does anyone get what I'm trying to articulate? :) > > Multiply by 2, round(), divide

Re: [Tutor] Rounding a Python float to the nearest half integer

2010-10-08 Thread Evert Rol
> I realise that one cannot have a half integer :) I meant how would one round > off to the first decimal nearest to either 0.5, or a whole number. > > Ugh...does anyone get what I'm trying to articulate? :) Multiply by 2, round(), divide by 2? > > On Fri, Oct 8, 2010 at 2:51 PM, Sithembewena

Re: [Tutor] Rounding a Python float to the nearest half integer

2010-10-08 Thread Wayne Werner
On Fri, Oct 8, 2010 at 7:51 AM, Sithembewena Lloyd Dube wrote: > Hi folks, > > Supposing I had the float 4.4348 and I wished to round it off to the > nearest half-integer upwards or downwards, how would I go about it? > You can use round: round(4.4348) -> 4.0 But if you want to specify the beha

Re: [Tutor] Rounding a Python float to the nearest half integer

2010-10-08 Thread Sithembewena Lloyd Dube
I realise that one cannot have a half integer :) I meant how would one round off to the first decimal nearest to either 0.5, or a whole number. Ugh...does anyone get what I'm trying to articulate? :) On Fri, Oct 8, 2010 at 2:51 PM, Sithembewena Lloyd Dube wrote: > Hi folks, > > Supposing I had t

[Tutor] Rounding a Python float to the nearest half integer

2010-10-08 Thread Sithembewena Lloyd Dube
Hi folks, Supposing I had the float 4.4348 and I wished to round it off to the nearest half-integer upwards or downwards, how would I go about it? Many thanks... -- Regards, Sithembewena Lloyd Dube http://www.lloyddube.com ___ Tutor maillist - Tutor

Re: [Tutor] list of dict question

2010-10-08 Thread Francesco Loffredo
Il 08/10/2010 10.02, Alan Gauld ha scritto: "Roelof Wobben" wrote I have this programm : tournooi = [{'thuis': 'A','uit': "B",'thuisscore': 20, 'uitscore': ... for wedstrijd in tournooi : if wedstrijd['thuis'] in stand : print "True" stand is a list of dictionaries so this will never be

Re: [Tutor] list of dict question

2010-10-08 Thread Roelof Wobben
> To: tutor@python.org > From: alan.ga...@btinternet.com > Date: Fri, 8 Oct 2010 09:02:05 +0100 > Subject: Re: [Tutor] list of dict question > > > "Roelof Wobben" wrote > >> I have this programm : >> >> tournooi = [{'thuis': 'A','uit': "B",'thuisscore': 2

Re: [Tutor] list of dict question

2010-10-08 Thread Alan Gauld
"Roelof Wobben" wrote I have this programm : tournooi = [{'thuis': 'A','uit': "B",'thuisscore': 20, 'uitscore': 15},{'thuis': 'C','uit': "D",'thuisscore': 80, 'uitscore': 40}] stand = [] tussen_thuis = {} tussen_uit = {} Here you create your dictionary objects. You never create any more d

[Tutor] list of dict question

2010-10-08 Thread Roelof Wobben
Hello, I have this programm : tournooi = [{'thuis': 'A','uit': "B",'thuisscore': 20, 'uitscore': 15},{'thuis': 'C','uit': "D",'thuisscore': 80, 'uitscore': 40}] stand = [] tussen_thuis = {} tussen_uit = {} for wedstrijd in tournooi : if wedstrijd['thuis'] in stand : print "True"