Re: [Tutor] Using os.path.walk

2011-06-22 Thread Kushal Kumaran
On Thu, Jun 23, 2011 at 9:02 AM, Becky Mcquilling wrote: > I have a bunch of files I need to remove in dirs and subdirs when they are > older than 7 days. > I was looking at os.path.walk, to recurse the directories, but I'm having > some difficulties with getting it to return the directory names o

[Tutor] Using os.path.walk

2011-06-22 Thread Becky Mcquilling
I have a bunch of files I need to remove in dirs and subdirs when they are older than 7 days. I was looking at os.path.walk, to recurse the directories, but I'm having some difficulties with getting it to return the directory names or find examples of it's use for something like this. So far, I a

Re: [Tutor] Class methods

2011-06-22 Thread Alan Gauld
"David Merrick" wrote Can someone show me how to code this correctly please? We've been doing that but you are still making some very basic mistakes which reflect a deep misunderastanding of what you are doing. You really should take several steps back and review the use of variables and fun

Re: [Tutor] Class methods

2011-06-22 Thread Alan Gauld
"michael scott" wrote you are using python 3 by your print statements, so I don't think you need the int() around your input, Yes he does because in Python 3 input is the same as raw_input in Python 2 even in python.2x input() was safe for numbers I believe (the whole list will rip my

Re: [Tutor] Class methods

2011-06-22 Thread michael scott
Just to add a little to Alexandre's answer.  You can keep most of the code the same just add in        farmlet[0].eat()     farmlet[1].eat() and it will be okay... kinda. Or you could rewrite it and  do it another way...  I'm guessing that you are using python 3 by your print sta

Re: [Tutor] Class methods

2011-06-22 Thread Alexandre Conrad
David, 2011/6/22 David Merrick : >     # listen to your critter >     elif choice == "1": >     for critter in farmlet: >     farmlet.talk() You want to call .talk() on your "critter" instance which has the .talk() method, not on farmlet (which is a list as the error m

[Tutor] Class methods

2011-06-22 Thread David Merrick
Can someone show me how to code this correctly please? # Critter Caretaker # A virtual pet to care for class Critter(object): """A virtual pet""" def __init__(self, name, hunger = 0, boredom = 0): self.name = name self.hunger = hunger self.boredom = boredom #

Re: [Tutor] Tutor Digest, Vol 88, Issue 89

2011-06-22 Thread David Merrick
> > Can someone show me how to code this correctly please > > > class Critter(object): > > > >def __init__(self, name, hunger = 0, boredom = 0): > >def __pass_time(self): > >def __str__(self): > >@property > >def mood(self): > >def talk(self): > >def eat(self): > >de

Re: [Tutor] Tutor Digest, Vol 88, Issue 89

2011-06-22 Thread David Merrick
Can someone show me how to code this correctly please On Wed, Jun 22, 2011 at 10:00 PM, wrote: > Send Tutor mailing list submissions to >tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, visit >http://mail.python.org/mailman/listinfo/tutor > or, via email,

Re: [Tutor] sftp get single file

2011-06-22 Thread Peter Lavelle
You could use the subprocess module to run the relevant system commands. More info on running sftp non-interactively (i.e from a script) can be found here: http://fixunix.com/ssh/238284-non-interactive-sftp-put.html Regards Peter Lavelle ___ Tutor ma

Re: [Tutor] Class methods

2011-06-22 Thread Alan Gauld
"David Merrick" wrote class Critter(object): def __init__(self, name, hunger = 0, boredom = 0): def __pass_time(self): def __str__(self): @property def mood(self): def talk(self): def eat(self): def play(self): class Farm(Critter): I still don't think a Farm is a typ