Re: re.sub and variables

2010-08-12 Thread MRAB
Steven D'Aprano wrote: On Thu, 12 Aug 2010 14:33:28 -0700, fuglyducky wrote: if anyone happens to know about passing a variable into a regex that would be great. The same way you pass anything into any string. Regexes are ordinary strings. If you want to construct a string from a variable t

Re: re.sub and variables

2010-08-12 Thread Steven D'Aprano
On Thu, 12 Aug 2010 14:33:28 -0700, fuglyducky wrote: > if anyone happens to know about > passing a variable into a regex that would be great. The same way you pass anything into any string. Regexes are ordinary strings. If you want to construct a string from a variable t = "orl", you can do an

Re: re.sub and variables

2010-08-12 Thread John Machin
On Aug 13, 7:33 am, fuglyducky wrote: > On Aug 12, 2:06 pm, fuglyducky wrote: > > > > > I have a function that I am attempting to call from another file. I am > > attempting to replace a string using re.sub with another string. The > > problem is that the second string is a variable. When I get t

Re: re.sub and variables

2010-08-12 Thread fuglyducky
On Aug 12, 2:06 pm, fuglyducky wrote: > I have a function that I am attempting to call from another file. I am > attempting to replace a string using re.sub with another string. The > problem is that the second string is a variable. When I get the > output, it shows the variable name rather than t

re.sub and variables

2010-08-12 Thread fuglyducky
I have a function that I am attempting to call from another file. I am attempting to replace a string using re.sub with another string. The problem is that the second string is a variable. When I get the output, it shows the variable name rather than the value. Is there any way to pass a variable i