[Tutor] Why are these results different?

2009-11-19 Thread Stephen Nelson-Smith
I'm seeing different behaviour between code that looks to be the same. It obviously isn't the same, so I've misunderstood something: log_names ('access', 'varnish') log_dates ('20091105', '20091106') logs = itertools.chain.from_iterable(glob.glob('%sded*/%s*%s.gz' % (source_dir, log,

Re: [Tutor] Why are these results different?

2009-11-19 Thread Alan Gauld
Stephen Nelson-Smith sanel...@gmail.com wrote I'm seeing different behaviour between code that looks to be the same. It obviously isn't the same, so I've misunderstood something: In the first instance the two for-loops are inside the chain() call. In the second you apply the chain inside

[Tutor] TypeError: Need Help

2009-11-19 Thread Ali Sina
I have Python 3.0 and I'm trying to learn from a pdf document. I followed its instructions but I've encountered a problem in its Pickling chapter. This is the code I've written: import pickle, shelve print('Pickling list.') variety=['sweet','hot','dill'] shape=['whole','spear','chip']

Re: [Tutor] proxy switcher - was Re: I love python / you guys :)

2009-11-19 Thread bibi midi
-- Forwarded message -- From: bibi midi bibsmen...@gmail.com Date: Tue, Nov 17, 2009 at 11:12 PM Subject: Re: [Tutor] proxy switcher - was Re: I love python / you guys :) To: Dave Angel da...@ieee.org Cc: Luke Paireepinart rabidpoob...@gmail.com, tutor tutor@python.org Hi guys!

Re: [Tutor] Readable date arithmetic

2009-11-19 Thread Kent Johnson
On Thu, Nov 19, 2009 at 1:14 AM, Stephen Nelson-Smith sanel...@gmail.com wrote: I have the following method: def get_log_dates(the_date_we_want_data_for):  t = time.strptime(the_date_we_want_data_for, '%Y%m%d')  t2 = datetime.datetime(*t[:-2]) Use datetime.datetime.strptime() to save a step:

Re: [Tutor] Why are these results different?

2009-11-19 Thread Kent Johnson
On Thu, Nov 19, 2009 at 3:24 AM, Stephen Nelson-Smith sanel...@gmail.com wrote: I'm seeing different behaviour between code that looks to be the same.  It obviously isn't the same, so I've misunderstood something: log_names ('access', 'varnish') log_dates ('20091105', '20091106') logs =

[Tutor] elementtree question

2009-11-19 Thread Albert-Jan Roskam
Hi,   I have an elementtree question that probably reflects my inexperience with xml processing (and/or with Python). The xml file is a stream of the Spss Clementine program. Each stream consists of, among others, nodes. Each nodes has properties, among which tooltiptext and label. I want to

Re: [Tutor] elementtree question

2009-11-19 Thread Gerard Flanagan
Albert-Jan Roskam wrote: Hi, I have an elementtree question that probably reflects my inexperience with xml processing (and/or with Python). The xml file is a stream of the Spss Clementine program. Each stream consists of, among others, nodes. Each nodes has properties, among which

Re: [Tutor] TypeError: Need Help

2009-11-19 Thread Dave Angel
Ali Sina wrote: I have Python 3.0 and I'm trying to learn from a pdf document. I followed its instructions but I've encountered a problem in its Pickling chapter. This is the code I've written: import pickle, shelve print('Pickling list.') variety=['sweet','hot','dill']

Re: [Tutor] Readable date arithmetic

2009-11-19 Thread Dave Angel
Kent Johnson wrote: On Thu, Nov 19, 2009 at 1:14 AM, Stephen Nelson-Smith sanel...@gmail.com wrote: I have the following method: def get_log_dates(the_date_we_want_data_for): t =ime.strptime(the_date_we_want_data_for, '%Y%m%d') t2 =atetime.datetime(*t[:-2]) Use

[Tutor] Handling missing positional arguments

2009-11-19 Thread Geoff Dutton
Hi Group, I have been following the Tutor group for awhile but this is my first post Do you have recommendations for handling missing positional arguments? I'm a huge fan of OptionParser module and use it in several programs to handle options, but there must be an eligant way of handling

[Tutor] Can a method be added to dictionary?

2009-11-19 Thread lauren
Hey Gang, Can a function/method be added to a dictionary like so: myDictionary = {string:processString(parameter), string2:processString2(parameter), string3:processString3(parameter) } I am basically interested in doing this with a Combobx Event.

Re: [Tutor] Can a method be added to dictionary?

2009-11-19 Thread John Fouhy
2009/11/20 lau...@protopc.com: Hey Gang, Can a function/method be added to a dictionary like so: myDictionary = {string:processString(parameter),                string2:processString2(parameter),                string3:processString3(parameter)               } I am basically interested

Re: [Tutor] Can a method be added to dictionary?

2009-11-19 Thread lauren
John, Thank you so much for your help! -- Problem SOLVED!!! -- Your explanation and example was extremely helpful. I am very grateful. Lauren :-) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

[Tutor] Outputting Data to Printer

2009-11-19 Thread Ken G.
Is there a Python command to send data to printer? I have a Canon MX300 hooked up by USB. I can print from Firefox and Thunderbird. I am using Ubuntu 9.04 and Python 2.6.2. I could print to a file and then use gedit to print out the content of the file but I was wondering if there was an

[Tutor] Querying a packages modules?

2009-11-19 Thread Eric Pavey
Say I have this package layout - \myPackage - __init__.py - moduleA.py - moduleB.py Is there a way (and I'm sure there is...) to query, for a given package level, which modules live under it? I thought I could do it like so: import myPackage goodQualityInfo = dir(myPackage)

[Tutor] copy zip file from source folder to destination and unzip all files within destination

2009-11-19 Thread MARCUS NG
Hey all, I have been searching online for ways to copy a zip file to a destination and extract the zip file with python. Currently nothing works due to my limited understanding. I am wondering if my syntax is wrong or am I missing anything? the code is as such. also if there is a better code, I am