At Sunday 26/11/2006 01:29, wo_shi_big_stomach wrote:
for line in fileinput.input(g, inplace=1, backup='.bak'):
# just print 2nd and subsequent lines
if not fileinput.isfirstline():
print line.rstrip('\n')
# check first line only
elif fileinput.isfirstline
Dennis Lee Bieber wrote:
> On Sat, 25 Nov 2006 07:58:26 -0800, wo_shi_big_stomach
> <[EMAIL PROTECTED]> declaimed the following in
> comp.lang.python:
>
>> File "p2.py", line 23, in ?
>> for line in fileinput.input(f,):
>> File
>> "/System/Library/Frameworks/Python.framework/Versions/2.3/l
Gabriel Genellina wrote:
> At Saturday 25/11/2006 00:14, wo_shi_big_stomach wrote:
>
>> > The filter should be applied to walkfiles. Something like this:
>> >
>> > dir = path(/home/wsbs/Maildir)
>> > for f in filter(os.path.isfile, dir.walkfiles('*')):
>> > #
>> > # test:
>> >
At Saturday 25/11/2006 00:14, wo_shi_big_stomach wrote:
> The filter should be applied to walkfiles. Something like this:
>
> dir = path(/home/wsbs/Maildir)
> for f in filter(os.path.isfile, dir.walkfiles('*')):
> #
> # test:
> # print f
Thanks, this way f will print the
Gabriel Genellina wrote:
> The filter should be applied to walkfiles. Something like this:
>
> dir = path(/home/wsbs/Maildir)
> for f in filter(os.path.isfile, dir.walkfiles('*')):
> #
> # test:
> # print f
Thanks, this way f will print the full pathname/filename. But f a
At Thursday 23/11/2006 12:21, wo_shi_big_stomach wrote:
>> dir = path(/home/wsbs/Maildir)
>> for f in dir.walkfiles('*'):
>> #
>> # test:
>> # print f
>
> Are you absolutely sure that f list doesn't contain
> any path to directory, not file?
> Add this:
>
> f = filter(os.p
On 11/23/06 6:15 AM, Rob Wolfe wrote:
> wo_shi_big_stomach wrote:
>> Newbie to python writing a script to recurse a directory tree and delete
>> the first line of a file if it contains a given string. I get the same
>> error on a Mac running OS X 10.4.8 and FreeBSD 6.1.
>>
>> Here's the script:
>>
wo_shi_big_stomach wrote:
> Newbie to python writing a script to recurse a directory tree and delete
> the first line of a file if it contains a given string. I get the same
> error on a Mac running OS X 10.4.8 and FreeBSD 6.1.
>
> Here's the script:
>
> # start of program
>
> # p.pl - fix broken
Newbie to python writing a script to recurse a directory tree and delete
the first line of a file if it contains a given string. I get the same
error on a Mac running OS X 10.4.8 and FreeBSD 6.1.
Here's the script:
# start of program
# p.pl - fix broken SMTP headers in email files
#
# recurses f