Re: removing comments form a file

2005-01-03 Thread Noud Aldenhoven
Ah, Thank you, I never thaught about the re module. Now I can do some cool stuf. Greetings, Noud Aldenhoven ps. Zal ik een keer langs komen? ;-P [EMAIL PROTECTED] wrote: > You cold do something like this: > import re commentpattern = re.compile('.*(?=//)|.*(?!//)') stringwithc

RE: removing comments form a file

2005-01-03 Thread Craig Ringer
On Mon, 2005-01-03 at 11:46 -0300, Batista, Facundo wrote: > - Used file instead of open, to don't read the whole file in memory. [EMAIL PROTECTED] ~]$ python Python 2.3.4 (#1, Oct 26 2004, 16:42:40) .>>> file is open True .>>> print repr(file), repr(open) I'd be interested if you could clarif

Re: removing comments form a file

2005-01-03 Thread [EMAIL PROTECTED]
You cold do something like this: >>> import re >>> commentpattern = re.compile('.*(?=//)|.*(?!//)') >>> stringwithcomment = 'Blah di blah // some comment' >>> match = commentpattern.match(stringwithcomment) >>> match.group() 'Blah di blah ' >>> stringwithoutcomment = 'Blah di blah' >>> match = com

RE: removing comments form a file

2005-01-03 Thread Batista, Facundo
Title: RE: removing comments form a file [Noud Aldenhoven] #- Hello everyone, #- #- I was wondering how to remove comments away form a file. I remade it: #!/usr/bin/env python import sys import time helptext = "usage: python rmcomment &q