[Tutor] fileinput question

Ezra Taylor ezra.taylor at gmail.com
Mon Aug 25 05:15:00 CEST 2008

Thanks Kent, that works.

On Sun, Aug 24, 2008 at 10:33 PM, Kent Johnson <kent37 at tds.net> wrote:
> On Sun, Aug 24, 2008 at 9:26 PM, Ezra Taylor <ezra.taylor at gmail.com> wrote:
>> Hello all:
>>                 Can I do the below with input() from fileinput?  If
>> this is not possible, what can I do to create backup files with the
>> date timestamp as an extension.  Thanks for you help all.
>> from time import strftime
>> for line in fileinput.input(inplace=1,backup='.strftime("%Y-%b-%d.%S")'
> Close, but not quite. strftime() won't be recognized in a string, but
> you can include the leading period in the format string. Try
>  fileinput.input(inplace=1,backup=strftime(".%Y-%b-%d.%S")
> Kent

Ezra Taylor

More information about the Tutor mailing list