[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] Creating a class and calling an exception

2011-06-03 Thread Becky Mcquilling
Gauld wrote: > > "Becky Mcquilling" wrote > > The Second script written here, always raises the exception and I'm >> missing >> why, any advice? >> class Log_Parser: >> def __init__(self): >> self.re_backup_status = re.compile(r

[Tutor] Creating a class and calling an exception

2011-06-03 Thread Becky Mcquilling
So I'm new to doing creating classes in python and took a script I had written to parse a log file and tried to create a class just to understand it a little better. The first script below works fine. It looks at the log, checks the date and if it's too old, raises the exception and returns a set

Re: [Tutor] Question about comparing values

2011-05-22 Thread Becky Mcquilling
Thanks, you are correct of course. I need to just scrap this and start over, but I understand it a lot better now. On Sun, May 22, 2011 at 4:57 PM, Alan Gauld wrote: > "Becky Mcquilling" wrote > > I'm doing a tutorial and was given a problem, using shelve. >>

[Tutor] Question about comparing values

2011-05-22 Thread Becky Mcquilling
I realize this is a fairly generic type of question, but being new to programming, I'm not sure how best to approach it. I'm doing a tutorial and was given a problem, using shelve. It's taking a user name and then asking for scores in a game, until you end the loop. Whatever score is the high sc

[Tutor] Equivalent of Set in PtO

2011-04-26 Thread Becky Mcquilling
I have a code snippet that I have used to count the duplicates in a list as such: from sets import Set def countDups(duplicateList): uniqueSet = Set(item for item in duplicateList) return[(item, duplicateList.count(item)) for item in uniqueSet] lst = ['word', 'word', 'new', 'new', 'new'] pr

Re: [Tutor] Creating Binary Files of 1MB

2011-04-17 Thread Becky Mcquilling
Thanks, Steve. For the first step, I just wasn't sure how to write the file. I appreciate the help. Becky On Sun, Apr 17, 2011 at 12:34 AM, Steven D'Aprano wrote: > Becky Mcquilling wrote: > >> I'm trying to work out a method to create a binary file of 1mb and I&#x

[Tutor] Creating Binary Files of 1MB

2011-04-16 Thread Becky Mcquilling
I'm trying to work out a method to create a binary file of 1mb and I'm somewhat confused by the docs I'm reading is there a method that will do this? Becky ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail

[Tutor] Writing to the file system and verify the files written out.

2011-04-14 Thread Becky Mcquilling
Hi, all: I'm doing a tutorial online and I have run across an assignment to write a unit test. One of the tests is working fine, the other one is failing. The goal of this particular one is: 1) Create a directory 2) Create files in the directory that are listed in the text files 3) Crea

Re: [Tutor] Help with python-gnupg

2011-03-12 Thread Becky Mcquilling
Thanks, everyone: Your suggestions worked. I will make sure to include full information next time. Becky On Sat, Mar 12, 2011 at 12:14 AM, Steven D'Aprano wrote: > Becky Mcquilling wrote: > >> If anyone is familiar with python-gnupg, I am having some difficulty with >>

[Tutor] Help with python-gnupg

2011-03-11 Thread Becky Mcquilling
If anyone is familiar with python-gnupg, I am having some difficulty with the syntax. I've tried the following: f = open('c:/test/filename.txt', 'r') datae = gpg.encrypt_file(f.read(), 'ladym...@gmail.com', output=open('c:/gpg_test/data.gpg2', 'w')) or file_to_encrypt = open('c:/gpg_test/data.gp

Re: [Tutor] Expanding a variable with subprocess on Windows

2011-03-08 Thread Becky Mcquilling
Thanks, Sander. That was simple enough, as I'm learning I sometimes get caught up in these all too silly mistakes. Becky On Mon, Mar 7, 2011 at 11:38 PM, Sander Sweers wrote: > On Tue, 8 Mar 2011, 07:44:31 CET, Becky Mcquilling < > ladymcse2...@gmail.com> wrote: > >

Re: [Tutor] Expanding a variable with subprocess on Windows

2011-03-07 Thread Becky Mcquilling
I'm working on a Windows machine and want to use subprocess to run several commands from the command line. Normally with bat files or some of the other scripting languages on Windows, I would set up a variable with the path to the command like so: gpg = 'c:/program files (x86)/gnu/gnupg/gpg2.exe'

Re: [Tutor] Need some help on output

2011-03-03 Thread Becky Mcquilling
Thanks, that helped. I took a second look and realized where I had tried calling the .strip() method was wrong. Appreciate the pointer. Becky On Thu, Mar 3, 2011 at 5:37 PM, Kushal Kumaran < kushal.kumaran+pyt...@gmail.com> wrote: > On Fri, Mar 4, 2011 at 6:48 AM, Becky Mcquilling

[Tutor] Need some help on output

2011-03-03 Thread Becky Mcquilling
I am creating a dictionary by parsing a text file. The code is below: backup_servers = {} fo = open('c:/test/backup_shares.txt') for line in fo: backup_server = line.split(',') backup_servers[backup_server[0]]=backup_server[1] for i, v in backup_servers.items(): backup_shares = i archive

Re: [Tutor] Formatting a string

2011-02-01 Thread Becky Mcquilling
Thanks, as always. It all works. Becky On Tue, Feb 1, 2011 at 7:08 AM, Alan Gauld wrote: > "Becky Mcquilling" wrote > > > Basically, I need to format a string as an example: >> >> "He is {what}.format("{wild}") >> >> I want to in

[Tutor] Formatting a string

2011-02-01 Thread Becky Mcquilling
Quick question to the group to solve an immediate problem and then if anyone has a dead simple reference on formatting strings it would be greatly appreciated as I'm finding this to be pretty confusing. Basically, I need to format a string as an example: "He is {what}.format("{wild}") I want to

[Tutor] Python and Tuples

2011-01-30 Thread Becky Mcquilling
I'm fairly new to python and I am trying to do some math with tuples. If I have a tuple: t =( (1000, 2000), (2, 4), (25, 2)) I want to loop through and print out the results of the multiplying the two numbers like so: 1000 x 2000 2 x 4 etc. I'm not sure of the syntax for that. Any ideas? Bec

Re: [Tutor] What books do you recommend?

2009-12-11 Thread Becky Mcquilling
wrote: > > "Becky Mcquilling" wrote > > Good points. I guess being as new as I am I'm not always sure of the >> obvious way to do something or what I think is right, >> > > One thing to remember is that it is always subjective. > There is no such thing as

Re: [Tutor] What books do you recommend?

2009-12-10 Thread Becky Mcquilling
Good points. I guess being as new as I am I'm not always sure of the obvious way to do something or what I think is right, may not be an having explained examples are best, particularly after I've spent time solving the problem. But others may not find this useful. I admit that learning this stu

Re: [Tutor] What books do you recommend?

2009-12-09 Thread Becky Mcquilling
mped and a few hints would go a long way, then having the answer presented, with an explanation, even further. Becky On Wed, Dec 9, 2009 at 4:19 PM, Alan Gauld wrote: > > "Becky Mcquilling" wrote > > > Is there a good Tutorial that you guys recommend, where you actually ge

Re: [Tutor] What books do you recommend?

2009-12-09 Thread Becky Mcquilling
Is there a good Tutorial that you guys recommend, where you actually get a useful exercise to try and do and then you can be walked through different solutions? I'm not a Programmer by trade, but I do a bit of coding for Administrator type functions and have to debug stuff and starting to do this