Re: [Tutor] Python open of c:\ path Problem

2008-08-23 Thread Martin Walsh
Alan Gauld wrote: > "Wayne Watson" <[EMAIL PROTECTED]> wrote > >> BTW, how does one continue a long statement >> that has, say, a long path to a file? > > You can create a long string by adding the shorter string > elements : > > f = open( > "a:/very/long/path/name/that/needs/a/whole/line/to./it

Re: [Tutor] Adding Lists?

2008-08-23 Thread bob gailer
Alan Gauld wrote: "Emile van Sebille" <[EMAIL PROTECTED]> wrote yet if i wrote range (1, 500, 2) [1, 3, 5, 7... ..499] is there a command where i could total that list quickly? You're looking for sum -- sum(range (1, 500, 2) ) Or on older Python versions reduce: import operator s =

Re: [Tutor] Python open of c:\ path Problem

2008-08-23 Thread Alan Gauld
"Wayne Watson" <[EMAIL PROTECTED]> wrote junkfile = open('c:\tmp\junkpythonfile','w') IOError: [Errno 2] No such file or directory: 'c:\tmp\\junkpythonfile' I suspect the problem is with the back slash. Comments? Correct. There are several ways round this, the simplest being to use forw

Re: [Tutor] Adding Lists?

2008-08-23 Thread Alan Gauld
"Emile van Sebille" <[EMAIL PROTECTED]> wrote yet if i wrote range (1, 500, 2) [1, 3, 5, 7... ..499] is there a command where i could total that list quickly? You're looking for sum -- sum(range (1, 500, 2) ) Or on older Python versions reduce: import operator s = reduce(operator.ad

Re: [Tutor] Graphically Display Binary Trees

2008-08-23 Thread Chris Fuller
Graphviz (http://www.graphviz.org/) is great for this sort of thing, but it's an external program. There is a Python interface, pydot (http://dkbza.org/pydot.html) Cheers On Saturday 23 August 2008 15:34, Daniel Sarmiento wrote: > Hi > > I am working on a red-black binary tree class. I would

[Tutor] Graphically Display Binary Trees

2008-08-23 Thread Daniel Sarmiento
Hi I am working on a red-black binary tree class. I would like to print it in a nice, graphical way. I have never done any GUI programming, or generated any graphics in python, before. What libraries would you use, what's the most straight forward way to achieve what I want? Thank you. _

Re: [Tutor] Adding Lists?

2008-08-23 Thread Emile van Sebille
Tom Wakelam wrote: yet if i wrote range (1, 500, 2) [1, 3, 5, 7... ..499] is there a command where i could total that list quickly? You're looking for sum -- sum(range (1, 500, 2) ) ___ Tutor maillist - Tutor@python.org http://mail.python.o

Re: [Tutor] Python open of c:\ path Problem

2008-08-23 Thread Todd Zullinger
Kent Johnson wrote: > The \ character is a special 'escape' character that is used to insert > non-printing characters into a string. \t represents a single tab > character, not the two characters \ and t. > > To put an actual backslash into a string, you can either double it: > 'c:\\tmp\\junkpyth

[Tutor] Adding Lists?

2008-08-23 Thread Tom Wakelam
Hi, hope i've got the email right, and you can help If i have a list of integers, could i then total up the list? e.g. range (1, 5) gives [1, 2, 3, 4] which is easily totalled at 10, yet if i wrote range (1, 500, 2) [1, 3, 5, 7... ..499] is there a command where i could total that list q

Re: [Tutor] Python open of c:\ path Problem

2008-08-23 Thread Kent Johnson
On Sat, Aug 23, 2008 at 9:56 AM, Wayne Watson <[EMAIL PROTECTED]> wrote: > Python doesn't like this: > > junkfile = open('c:\tmp\junkpythonfile','w') > > I get > junkfile = open('c:\tmp\junkpythonfile','w') > IOError: [Errno 2] No such file or directory: 'c:\tmp\\junkpythonfile' The \ characte

Re: [Tutor] __iter__ loops, partitioning list among children

2008-08-23 Thread Kent Johnson
On Sat, Aug 23, 2008 at 6:47 AM, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: > At first I thought the bisect module was the way to go, but it is too > tightly tied to integer list indices, and works very awkwardly when > bisecting on datetime attributes. I'm not sure what the problem is with bisect

Re: [Tutor] Python Docs (Was: Reformatting phone number)

2008-08-23 Thread Kent Johnson
On Fri, Aug 22, 2008 at 9:46 AM, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > What I find lacking in the docs are a link to a code example for every item > and a "See Also" link to other related items. With some modules I can't make > sense of the different bits and pieces till I see a code example,

[Tutor] Python open of c:\ path Problem

2008-08-23 Thread Wayne Watson
Title: Signature.html Python doesn't like this: junkfile = open('c:\tmp\junkpythonfile','w') I get     junkfile = open('c:\tmp\junkpythonfile','w') IOError: [Errno 2] No such file or directory: 'c:\tmp\\junkpythonfile' This problematic segment is just a hack of a similar statement which

Re: [Tutor] Problem with creating a class to access a 2d array

2008-08-23 Thread Lie Ryan
On Sat, 2008-08-23 at 12:00 +0200, [EMAIL PROTECTED] wrote: > > Message: 1 > Date: Fri, 22 Aug 2008 20:46:25 -0400 > From: "lawful falafel" <[EMAIL PROTECTED]> > Subject: [Tutor] Problem with creating a class to access a 2d array > To: tutor@python.org > Message-ID: > <[EMAIL PROTECTED]> >

Re: [Tutor] Problems with Gauge Bar.

2008-08-23 Thread Olrik Lenstra
Thanks Bill. That does work! Thanks a lot! :) Regards, Olrik 2008/8/23 Bill Burns <[EMAIL PROTECTED]> > Olrik Lenstra wrote: > >> It works! :) >> My program is now as good as done, only one thing that bothers me a bit. >> When I click the scan button the GUI Freezes because it is handling the >>

[Tutor] __iter__ loops, partitioning list among children

2008-08-23 Thread Eric Abrahamsen
Hi, I've got a problem that takes a bit of explaining, but it's relatively simple when you get down to it. This is another django-related thing, but the issue itself is pure python. I made a custom class, called an EventEngine, which represents a span of time. You initialize it with a que

Re: [Tutor] Problem with creating a class to access a 2d array

2008-08-23 Thread Alan Gauld
"lawful falafel" <[EMAIL PROTECTED]> wrote I really like python, but the one thing I really hate is that most of the tutorials treat it like interactive scripting instead of object oriented development, which really confuses me. Can you explain what confuses you about that? The original Obj

Re: [Tutor] Problem with creating a class to access a 2d array

2008-08-23 Thread wesley chun
> I am currently trying to teach myself python. This isnt my first language, > as I used to be quite good at using java. you are in good shape... you will only need to "tweak" some of your notions with regards to Java for Python, and you will be in good shape. > I really like python, but the one