Re: 20050126 find replace strings in file

2005-01-26 Thread alex23
kosh wrote: > Nah it is daily humor. Just think of it like a joke list. :) Or a daily puzzler: how many blatantly stupid things can you find in 5 mins? -- http://mail.python.org/mailman/listinfo/python-list

Re: 20050126 find replace strings in file

2005-01-26 Thread kosh
On Wednesday 26 January 2005 7:13 pm, Tad McClellan wrote: > [ Followup set ] > > Dan Perl <[EMAIL PROTECTED]> wrote: > > I can't imagine why or how, but there are > > actually 26 members in the perl-python Yahoo! group who have registered > > to get these bogus lessons sent to them daily! > > Ther

Re: 20050126 find replace strings in file

2005-01-26 Thread Tad McClellan
[ Followup set ] Dan Perl <[EMAIL PROTECTED]> wrote: > I can't imagine why or how, but there are > actually 26 members in the perl-python Yahoo! group who have registered to > get these bogus lessons sent to them daily! There is one born every minute. -- Tad McClellan

Re: [perl-python] 20050126 find replace strings in file

2005-01-26 Thread Eric Schwartz
To follow up on Jurgen Exner's critique, I present Xah Lee's version, and then my rewritten version. "Xah Lee" <[EMAIL PROTECTED]> writes: > if (scalar @ARGV != 4) {die "Wrong arg! Unix BNF: $0 > \n"} > $stext=$ARGV[0]; > $rtext=$ARGV[1]; > $infile = $ARGV[2]; > $outfile = $ARGV[3]; > open(F1,

Re: [perl-python] 20050126 find replace strings in file

2005-01-26 Thread Jürgen Exner
Xah Lee wrote: [...] > In perl, similar code can be achieved. > the following code illustrates. > > if (scalar @ARGV != 4) Why scalar()? The comparison already creates a scalar context, no need to enforce it twice. > {die "Wrong arg! Unix BNF: $0 > \n"} > $stext=$ARGV[0]; > $rtext=$ARGV[1];

Re: 20050126 find replace strings in file

2005-01-26 Thread Ala Qumsieh
[EMAIL PROTECTED] wrote: Xah Lee wrote: close(F1) or die "Perl fucked up. Reason: $!"; close(F2) or die "Perl fucked up. Reason: $!"; Same here. Never seen Perl fuck up on closing a file. Usually something in the OS or file system that does it. In this case, I'm pretty sure it's the user. --Ala

Re: 20050126 find replace strings in file

2005-01-26 Thread Dan Perl
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I guess there is no way to check if the file opened fine? What if the > filesystem or file is locked for this user/session. Pretty puny > language if it cannot tell you that it cannot do what you tell it to. > .. > Same for t

Re: 20050126 find replace strings in file

2005-01-26 Thread takarov2003
Xah Lee wrote: > © # -*- coding: utf-8 -*- > © # Python > © > © import sys > © > © nn = len(sys.argv) > © > © if not nn==5: > © print "error: %s search_text replace_text in_file out_file" % > sys.argv[0] > © else: > © stext = sys.argv[1] > © rtext = sys.argv[2] > © input = open(sys.

Re: [perl-python] 20050126 find replace strings in file

2005-01-26 Thread Haibao Tang
OK. But please don't die throwing that string, or this post will lose its educational purpose as it was meant to be. -- http://mail.python.org/mailman/listinfo/python-list

[perl-python] 20050126 find replace strings in file

2005-01-26 Thread Xah Lee
© # -*- coding: utf-8 -*- © # Python © © import sys © © nn = len(sys.argv) © © if not nn==5: © print "error: %s search_text replace_text in_file out_file" % sys.argv[0] © else: © stext = sys.argv[1] © rtext = sys.argv[2] © input = open(sys.argv[3]) © output = open(sys.argv[4],'w