[Tutor] What's up with Python 2.5.1's IDLE?

2007-09-02 Thread Dick Moores
Under Kent's tutelage, I've been experimenting with having no PYTHONDOC, and instead putting a .pth file in E:\Python25\lib\site-packages\ I named pointers.pth. The contents of pointers.pth is: E:\Python25\ E:\PythonWork\ E:\PythonWork\Functions\ E:\Python25\lib\site-packages\ E:\Python25\lib\si

[Tutor] replacement for .mainloop() in Tk

2007-09-02 Thread Trey Keown
Okay, I'm making a program that turns xml code into python code. Here's the an example of input- And here would be the corresponding output (well, what I've got so far...) from Tkinter import * import tk

Re: [Tutor] [tutor] Difference between index and find in manipulating strings

2007-09-02 Thread Alan Gauld
"Ricardo Aráoz" <[EMAIL PROTECTED]> wrote >> Thanks guys it was really helpful i m just a beginner in >> python >> start to program since two days back. So finding little difficulty >> with >> some concepts. >> > > Don't worry, I'm a 20 days "old timer". ;c) And I've been using Python for

Re: [Tutor] [tutor] Difference between index and find in manipulating strings

2007-09-02 Thread Ricardo Aráoz
Varsha Purohit wrote: > > Thanks guys it was really helpful i m just a beginner in python > start to program since two days back. So finding little difficulty with > some concepts. > Don't worry, I'm a 20 days "old timer". ;c) ___ Tutor maillist

Re: [Tutor] [tutor] Difference between index and find in manipulating strings

2007-09-02 Thread Alan Gauld
"Ricardo Aráoz" <[EMAIL PROTECTED]> wrote >>From Python 2.5 documentation : > > index( sub[, start[, end]]) > Like find(), but raise ValueError when the substring is not found. As opposed to find() which returns -1 when the string is not found. That means you can use try/except with index but mu

Re: [Tutor] [tutor] Difference between index and find in manipulating strings

2007-09-02 Thread Varsha Purohit
Thanks guys it was really helpful i m just a beginner in python start to program since two days back. So finding little difficulty with some concepts. On 9/2/07, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > > Varsha Purohit wrote: > > Hello, > > i have again very basic question in python stri

Re: [Tutor] [tutor] Difference between index and find in manipulating strings

2007-09-02 Thread Ricardo Aráoz
Varsha Purohit wrote: > Hello, > i have again very basic question in python string management. > > I am not able to understand how find and index works and what do they > actually return. > line = "this is varsha" print line.find("is") > 2 print line.rfind("is") > 5 print li

Re: [Tutor] about modules, classes, methods, functions

2007-09-02 Thread Alan Gauld
"jim stockford" <[EMAIL PROTECTED]> wrote > If I write a little .py file, its name is __main__ > > assuming no big nit-picks in the claim above, > is __main__ a class? No, its the name of your module when its run as a script rather than imported. Its assigned by the interpreter. (At least i ass

[Tutor] [tutor] Difference between index and find in manipulating strings

2007-09-02 Thread Varsha Purohit
Hello, i have again very basic question in python string management. I am not able to understand how find and index works and what do they actually return. >>> line = "this is varsha" >>> print line.find("is") 2 >>> print line.rfind("is") 5 >>> print line.rfind("varsha") 8 >>> print line.index(

Re: [Tutor] about modules, classes, methods, functions

2007-09-02 Thread Kent Johnson
jim stockford wrote: > I've gotten red-eyed looking through google pages > to find answers. I've read the python.org docs and > tutorials entirely (some parts very quickly). > > If I write a little .py file, its name is __main__ > > assuming no big nit-picks in the claim above, > is __main__ a cl

[Tutor] Condensing Some Massive Code

2007-09-02 Thread David Millar
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 ways to clean up or condense the

[Tutor] about modules, classes, methods, functions

2007-09-02 Thread jim stockford
I've gotten red-eyed looking through google pages to find answers. I've read the python.org docs and tutorials entirely (some parts very quickly). If I write a little .py file, its name is __main__ assuming no big nit-picks in the claim above, is __main__ a class? What exactly does it mean "mod

Re: [Tutor] Best way to construct this

2007-09-02 Thread Alan Gauld
"Sean Cronin[tutor]" <[EMAIL PROTECTED]> wrote > (in case you couldn't tell :) ). However, I can't understand why > you want > to make a separate function called parse. OK, I want to make a separate *method* called parse, not a function. Methods are what you have inside classes. You send messa

Re: [Tutor] Backupfile program. Help. Thanks.

2007-09-02 Thread Ricardo Aráoz
shimon gurman wrote: > Can someone explain to me why this program isnt working? i.e. I always get > 'backup failed'? > This is a program from byte of python tutorial and im using windows xp. > > > > > import os, time > > > > source = ['d:\\python'] > > > target_directory = 'd:\\python1'

[Tutor] Backupfile program. Help. Thanks.

2007-09-02 Thread shimon gurman
Can someone explain to me why this program isnt working? i.e. I always get 'backup failed'? This is a program from byte of python tutorial and im using windows xp. import os, time source = ['d:\\python'] target_directory = 'd:\\python1' target = target_directory + time.strftime('%Y%m%d_%H%

Re: [Tutor] Accessing Values of specific column in a 2D list or array

2007-09-02 Thread Ricardo Aráoz
Varsha Purohit wrote: > Thanks Eric and Alan i did that with while loop. I donno i was getting > an error while using a for loop for subindexing. Here is what i did > > i=0 > selectCols=0 > arr2=[] > while i selectCols=grid[i][colID] > i+=1 > arr2.append(selectCols) > > print "col"

Re: [Tutor] Accessing Values of specific column in a 2D list or array

2007-09-02 Thread Varsha Purohit
Thanks Eric and Alan i did that with while loop. I donno i was getting an error while using a for loop for subindexing. Here is what i did i=0 selectCols=0 arr2=[] while icolID is the value of the requested column to print. which remains the same throughout the iteration of while. On 9/2/07, Ala

Re: [Tutor] Best way to construct this

2007-09-02 Thread Sean Cronin[tutor]
Hey, Thanks Alan for the help on the classes. This is my first time using them (in case you couldn't tell :) ). However, I can't understand why you want to make a separate function called parse. What I am trying to do by having different functions in the class like maxtemp, and mintemp, is to a

Re: [Tutor] problem resulting from installing 3.0

2007-09-02 Thread Dick Moores
At 08:17 AM 9/2/2007, Kent Johnson wrote: >Dick Moores wrote: >> >>>- add a .pth file to site-packages/ that contains the path to the >>>dir you want to add to sys.path >>I tried this with no PYTHONPATH. I put pointers.pth in >>site-packages\ with the single line, E:\PythonWork\Functions\ . >>Fu

Re: [Tutor] problem resulting from installing 3.0

2007-09-02 Thread Kent Johnson
Dick Moores wrote: > Thanks, Kent. > > At 05:40 AM 9/2/2007, Kent Johnson wrote: >> There are quite a few ways to get a module into the search path, >> modifying PYTHONPATH is just one way. Some others: >> - create a site-packages/ dir in the Python lib dir. Put your >> modules and packages ther

Re: [Tutor] problem resulting from installing 3.0

2007-09-02 Thread Dick Moores
Thanks, Kent. At 05:40 AM 9/2/2007, Kent Johnson wrote: >There are quite a few ways to get a module into the search path, >modifying PYTHONPATH is just one way. Some others: >- create a site-packages/ dir in the Python lib dir. Put your >modules and packages there and they will be found by Pytho

Re: [Tutor] problem resulting from installing 3.0

2007-09-02 Thread Alan Gauld
"Kent Johnson" <[EMAIL PROTECTED]> wrote > PYTHONPATH is for your own customizations of sys.path, it is not the > entirety of sys.path. AFAIK you don't have to define it at all if > you > don't want to use it. All true. The point of PYTHONPATH is that you could have several users all running pyt

Re: [Tutor] Accessing Values of specific column in a 2D list or array

2007-09-02 Thread Alan Gauld
"Varsha Purohit" <[EMAIL PROTECTED]> wrote > grid = [[1,1,2,7,6,9],\ > [,9,1,1,1,9,1],\ > [8,1,2,0,0,4],\ > [1,4,1,1,8,5]] You don't need the '\' characters, the fact that the closing bracket has not been reached means Python will ignore the newline characters. > ho

Re: [Tutor] problem resulting from installing 3.0

2007-09-02 Thread Kent Johnson
Dick Moores wrote: > At 01:08 AM 9/1/2007, Alan Gauld wrote: > >> "Dick Moores" <[EMAIL PROTECTED]> wrote >> >> > > > And another question is, exactly what should go into PYTHONPATH? >> > >> > >Its what goes into sys.path. PYTHONPATH is for your own customizations of sys.path, it is not the enti

Re: [Tutor] Accessing Values of specific column in a 2D list or array

2007-09-02 Thread Eric Abrahamsen
> > COL = 5 > [i[COL-1] for i in grid] Should have guessed... ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Accessing Values of specific column in a 2D list or array

2007-09-02 Thread Ricardo Aráoz
Varsha Purohit wrote: > > > Hello, > Suppose i have a 2D list(grid) like > > grid = [[1,1,2,7,6,9],\ > [,9,1,1,1,9,1],\ > [8,1,2,0,0,4],\ > [1,4,1,1,8,5]] > > how can i access to all the elements of the list from column no. 5. > > output should be like [6,9,0,

Re: [Tutor] Accessing Values of specific column in a 2D list or array

2007-09-02 Thread Eric Abrahamsen
> grid = [[1,1,2,7,6,9],\ > [,9,1,1,1,9,1],\ > [8,1,2,0,0,4],\ > [1,4,1,1,8,5]] > > how can i access to all the elements of the list from column no. 5. > > output should be like [6,9,0,8]... Your basic tool is sub-indexing: you can reach items in the sub-lists by us

Re: [Tutor] problem resulting from installing 3.0

2007-09-02 Thread Dick Moores
At 01:08 AM 9/1/2007, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote > > > And another question is, exactly what should go into PYTHONPATH? > > >Its what goes into sys.path. I've found that whether I'm using Command Prompt, IDLE, or Ulipad, that they add a lot to sys.path. When PYTHONP

[Tutor] Accessing Values of specific column in a 2D list or array

2007-09-02 Thread Varsha Purohit
Hello, Suppose i have a 2D list(grid) like grid = [[1,1,2,7,6,9],\ [,9,1,1,1,9,1],\ [8,1,2,0,0,4],\ [1,4,1,1,8,5]] how can i access to all the elements of the list from column no. 5. output should be like [6,9,0,8]... thanks,- Varsha Purohit, __

[Tutor] Accessing Values of specific column in a 2D list or array

2007-09-02 Thread Varsha Purohit
Hello, Suppose i have a 2D list(grid) like grid = [[1,1,2,7,6,9],\ [,9,1,1,1,9,1],\ [8,1,2,0,0,4],\ [1,4,1,1,8,5]] how can i access to all the elements of the list from column no. 5. output should be like [6,9,0,8]... thanks,- Varsha Purohit, __

Re: [Tutor] Best way to construct this

2007-09-02 Thread Alan Gauld
"Sean Cronin[tutor]" <[EMAIL PROTECTED]> wrote > Right now I have two modules named libndfdsoap and weatherpy. > Module > libndfdsoap contains one function that gets the XML and saves it to > a file > named weather.xml. Seems fair enough. > Module weatherpy contains some constants and a class