Re: [Tutor] optparse example

2008-09-22 Thread Carlos Hanson
_option("-q", ... The arguments are everything left over. In this case, they are not used, but they are required. The following runs without issue: $ python parser.py junk $ python parser.py -v junk reading None... The bottom line is the example is just an example, not something you

Re: [Tutor] String Replacement Question

2008-05-21 Thread Carlos Hanson
gt;> >> Does this help? > > Another approach is to use dictionaries for string > replacement. > >>>> subst = {'some': 'thing'} >>>> print "%(some)s%(some)s%(some)s" % subst > thingthingthing > As an alternate to r

Re: [Tutor] syntax question

2008-05-21 Thread Carlos Hanson
t if [theme in VALID_THEMES] becomes an index to the tuple: --> (VALID_THEMES[0], theme1)[1] 'moon' --> (VALID_THEMES[0], theme1)[0] 'sun' But we got [True] and [False]: --> True == 1 True --> False == 0 True So in words, the code returns the

Re: [Tutor] shebang problem

2006-11-04 Thread Carlos Hanson
test.py > > This is clearly executable by brian, and clearly being executed by > brian. The shebang line is correct (#!/usr/bin/python). > [...] Good call. I jumped on the answer without making sure I clearly read all the information provided. -- Carlos Hanson > > Carlos Han

Re: [Tutor] shebang problem

2006-11-04 Thread Carlos Hanson
is not executable, you would execute it as follows: $ python shebangtest.py As you found with `which python`, python is in /usr/bin, so executing the script is actually $ /usr/bin/python shebangtest.py Therefore, the shebang line needs to be as follows: #! /usr/bin/pyth

Re: [Tutor] I need a time object from the future

2006-10-20 Thread Carlos Hanson
a second may be present if the system clock provides them. >>> t1 = time() >>> t2 = t1 + 120*24*60*60 >>> now = time() >>> now > t1 and now < t2 True >>> ctime(t1) 'Fri Oct 20 09:09:26 2006' >>> ctime(t2) 'Sat Feb 17 08:09:2

Re: [Tutor] How to read content in a tar file with tarfile module

2006-10-10 Thread Carlos Hanson
member.size, member.mtime, member.name) ... 420 chanson/chanson 0 1160505068 file.1 420 chanson/chanson 0 1160505071 file.2 420 chanson/chanson 0 1160505075 file.3 -- Carlos Hanson Web and System Administrator Tigard-Tualatin School District 503.431.4053 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] question about looping.

2006-10-06 Thread Carlos Hanson
n file object: for i in routers: f = file(i, 'w') f.close() > Thanks for your time. > ___________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- Carlos Hanson Web Specialist Tigard-Tualatin School District 503.4