Help with substitution

Mike Fletcher mfletch at tpresence.com
Fri Aug 18 16:30:13 EDT 2000


Maybe something like:
re.sub( '\(\W*([0-9]+)\W*downto\W*([0-9]+)\)', r'[\1:\2]', 'sdfsdf(23 downto
43)sdf' )

HTH,
Mike

-----Original Message-----
From: Salman Sheikh [mailto:ssheikh at writeme.com]
Sent: Friday, August 18, 2000 4:10 PM
To: python-list at python.org
Subject: Help with substitution


Does anybody know how I can code this?

I have a file and i have to make substitutions like so:

(x downto y)  becomes [x:y]

where x and y any integer values.
I don't want to write a tons of re.compile/sub commands for
each possibility.


Salman


______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup


-- 
http://www.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list