[Tutor] Copy Files, Dates
Alan Gauld
alan.gauld@blueyonder.co.uk
Fri Apr 18 19:22:01 2003
> How do you copy files using Python?
Finding the right module is one of the hardest bits of learning
Python...
The one you need here is called shutil - obviously! :-)!
> First I need to find out if a string is a Date. Is there any IsDate
like
> function?
There is a string convertion function in the python time module.
You might want to use try/except to catch errors:
try: # convert the string
except: print 'oops! not a date'
There is also an addin mxDate module which gets good reviews,
it might have something.
> Also, is there a module that compares dates?
The basic time module lets you convert a date into a numeric value.
You can then compare the numbers, subract them to get the difference
etc.
HTH
Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld