[Tutor] Short Version, New guy looking for some tips, Revisited.

Joshua Banks syn_ack at comcast.net
Sat Feb 7 17:10:18 EST 2004

Hash: SHA1

On Saturday 07 February 2004 01:56 pm, Rich Krauter wrote:

Absolutely perfect Rich. I don't care if its somewhat broken. My problem 
is I didn't even know how to start the script.. :P

Sorry. But I've got all this documentation but I didn't even know how to 
start out the script. This is what was frustrating the heck out of me. 
It wasn't apparent to me to load all of these modules first. So this is 
perfect. Gets me researching in the right direction. Thanks for your 
understanding and taking the time to write this out.

Much appreciated.

Joshua Banks

> On Sat, 2004-02-07 at 16:26, Joshua Banks wrote:
> > Am I asking for  a simple example. Nothing more than that.
> Why don't you just take a stab at it? It doesn't have to be perfect.
> You should see how many dumb ideas I've posted in attempt to just
> take a stab at trying to solve something. Big deal. That's the whole
> point of the mailing list.
> Here's a quick example. It's bad and inflexible and very limited and
> likely to die very badly in many common situations, but maybe it'll
> get you started.
> <bad example>
> # requires python 2.3
> import tarfile
> import sys
> import os,os.path
> if __name__ == '__main__':
>     fname = 'test.tar'
>     ext = '.gz'
>     archive = '%s%s'%(fname,ext)
>     if os.path.exists(archive):
>          print 'gunzip-ing %s'%archive
>          os.system('gunzip %s'%(archive))
>     tar = tarfile.open(fname,'a')
>     for f in sys.argv[1:]:
>         print 'adding %s to %s ...'%(f,fname)
>         tar.add(f)
>     tar.close()
>     if os.path.exists(fname):
>         print 'gzip-ing %s'%fname
>         os.system('gzip %s'%fname)
> </bad example>
> Rich
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
Version: GnuPG v1.2.3 (GNU/Linux)


More information about the Tutor mailing list