Am Freitag, 7. Juni 2002 01:21 schrieben Sie: Thank you, Matias, for your reply. I tried out your script, but I get the following error when using it:
[EMAIL PROTECTED]:~/test$ ./datenumkehr.py jo-001.asc Traceback (most recent call last): File "./datenumkehr.py", line 14, in ? if float(numbers[i])>=0: ValueError: empty string for float() As I never learned python (nor an other scripting language), I don't know what that means, nor how to fix it. Any idea? joerg > > I have written a little python script to do it. Hope it works for you. :-) > > #!/usr/bin/env python > import re,sys,string > > if len(sys.argv) != 2: > print "Usage: %s infile" %(sys.argv[0]) > sys.exit() > infile = string.replace(open(sys.argv[1]).read(),"\n"," ") > pattern = re.compile(r"(?:(.+?[ ]) *)",re.DOTALL) > numbers = pattern.findall(infile) > outp = "" > for i in range(len(numbers)): > if (i%2): > outp+='\t' > if float(numbers[i])>=0: > outp+=' ' > outp+=numbers[i]+(' '*(10-len(numbers[i]))) > if float(numbers[i])>=0: outp+=' ' > if (i%2): > outp+='\n' > print outp > - -- > Matias Hermanrud Fjeld -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]