Thomas Jollans wrote:
On Wednesday 18 August 2010, it occurred to Brandon Harris to exclaim:
Having trouble using %s with re.sub
test = '/my/word/whats/wrong'
re.sub('(/)word(/)', r'\1\%s\2'%'1000', test)
return is /my/@0/whats/wrong
This has nothing to do with %, of course:
re.sub('(/)wo
On Wednesday 18 August 2010, it occurred to Brandon Harris to exclaim:
> Having trouble using %s with re.sub
>
> test = '/my/word/whats/wrong'
> re.sub('(/)word(/)', r'\1\%s\2'%'1000', test)
>
> return is /my/@0/whats/wrong
>
This has nothing to do with %, of course:
>>> re.sub('(/)word(/)', r
Having trouble using %s with re.sub
test = '/my/word/whats/wrong'
re.sub('(/)word(/)', r'\1\%s\2'%'1000', test)
return is /my/@0/whats/wrong
however if I cast a value with letters as opposed to numbers
re.sub('(/)word(/)', r'\1\%s\2'%'gosh', test)
return is /my/gosh/whats/wrong
Any help wou