Re: [Tutor] a function I fail to understand

2011-03-21 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Alex Hall wrote: On 3/21/11, David wrote: Hello list, I am having trouble understanding the following function. What trips me up is the "letter = letter.lower()" line. As I understand, the function takes a letter and assigns True to a letter if it is upper case. No

Re: [Tutor] a function I fail to understand

2011-03-21 Thread Marc Tompkins
On Mon, Mar 21, 2011 at 6:06 PM, David wrote: > Hello list, > > I am having trouble understanding the following function. What trips me > up is the "letter = letter.lower()" line. > > As I understand, the function takes a letter and assigns True to a > letter if it is upper case. > > But then he

Re: [Tutor] a function I fail to understand

2011-03-21 Thread Alex Hall
On 3/21/11, David wrote: > Hello list, > > I am having trouble understanding the following function. What trips me > up is the "letter = letter.lower()" line. > > As I understand, the function takes a letter and assigns True to a > letter if it is upper case. No, the function takes a letter and re

[Tutor] a function I fail to understand

2011-03-21 Thread David
Hello list, I am having trouble understanding the following function. What trips me up is the "letter = letter.lower()" line. As I understand, the function takes a letter and assigns True to a letter if it is upper case. But then he goes to letter = letter.lower() and all letters are converted

Re: [Tutor] getting the last file in a folder (reliably)

2011-03-21 Thread Steven D'Aprano
Pete O'Connell wrote: Hi I have some code which works nine times out of ten. Today. Next week it might work zero times out of ten. Your result is a pure accident of the order that the files are created. When you call os.listdir(), you don't get the files in any specific order. The order you

Re: [Tutor] getting the last file in a folder (reliably)

2011-03-21 Thread Rafael Durán Castañeda
You are taking the last file from os.listdir that hasn't neither ~ nor aoutosave, but os.listdir doesn't return a sorted list, so that file is random. You must order or compare in the for loop. 2011/3/21 Pete O'Connell > Hi I have some code which works nine times out of ten. Maybe some could > h

Re: [Tutor] help with user input

2011-03-21 Thread Donald Bedsole
Thank you, Marc On Mon, Mar 21, 2011 at 4:47 PM, Marc Tompkins wrote: > On Mon, Mar 21, 2011 at 1:12 PM, Donald Bedsole wrote: >> >> This works fine as long as the user enters a number.  However, if they >> enter anything else, they just get the first :else statement, "You >> were too greedy." >

[Tutor] getting the last file in a folder (reliably)

2011-03-21 Thread Pete O'Connell
Hi I have some code which works nine times out of ten. Maybe some could help me make this a little more robust. I have a bunch of files in a folder with a strict versioning based naming convention, where I want to open the highest version number of a nuke script (not necessarily the one with the ne

Re: [Tutor] help with user input

2011-03-21 Thread Marc Tompkins
On Mon, Mar 21, 2011 at 1:12 PM, Donald Bedsole wrote: > > This works fine as long as the user enters a number. However, if they > enter anything else, they just get the first :else statement, "You > were too greedy." > > I think that's because you're trying to do a string comparison, rather tha

[Tutor] help with user input

2011-03-21 Thread Donald Bedsole
I'm going through a tutorial called "Learn Python the Hard Way" by Zed Shaw. At the end of his lessons he has "Extra Credit" sessions, and I'm stuck on one. I'm on lesson 35, here is a link to it: http://blamcast.net/python/ex35.html The lesson involves creating a very simple text based game.

Re: [Tutor] Saving information for my program

2011-03-21 Thread Walter Prins
On 21 March 2011 15:11, michael scott wrote: > I was thinking I have 2 options, which is save the information to a text > file a write / read it in every session, but I have no idea how to do this > with class attributes. I know how to do it for like a paragraph of text, but > I have no idea how

Re: [Tutor] Saving information for my program

2011-03-21 Thread Marc Tompkins
On Mon, Mar 21, 2011 at 8:11 AM, michael scott wrote: > How do I save user created information in python? > As others have mentioned, SQL support is bundled with Python. If your collection of people and their attributes is expected to grow much, that would definitely be how I'd go. However, the

Re: [Tutor] Saving information for my program

2011-03-21 Thread bob gailer
On 3/21/2011 10:11 AM, michael scott wrote: I apologize now but I'm going to be spamming the tutor list as I have just decided to create an extremely ambitious project for someone of my level. Anyhow, I will start with my first question. Please no more apologies. Just post your questions. H

Re: [Tutor] Saving information for my program

2011-03-21 Thread James Reynolds
On Mon, Mar 21, 2011 at 11:11 AM, michael scott wrote: > I apologize now but I'm going to be spamming the tutor list as I have just > decided to create an extremely ambitious project for someone of my level. > Anyhow, I will start with my first question. > > How do I save user created information

Re: [Tutor] Saving information for my program

2011-03-21 Thread Joel Goldstick
On Mon, Mar 21, 2011 at 11:11 AM, michael scott wrote: > I apologize now but I'm going to be spamming the tutor list as I have just > decided to create an extremely ambitious project for someone of my level. > Anyhow, I will start with my first question. > > How do I save user created information

[Tutor] Saving information for my program

2011-03-21 Thread michael scott
I apologize now but I'm going to be spamming the tutor list as I have just decided to create an extremely ambitious project for someone of my level. Anyhow, I will start with my first question. How do I save user created information in python? In my progam I will have users input various "attr