Need help running external program

Rigga rigga at hasnomail.com
Sun Feb 27 12:51:24 EST 2005


Pink wrote:

> Rigga wrote:
> 
>> Hi,
>> 
>> I am running the line of code below from a shell script and it works
>> fine, however I am at a total loss on how i can run it from within a
>> Python script as every option I have tried fails and it appears to be
>> down to the escaping of certain characters.
>> 
>> wget -q www.anywebpage.com -O - | tr '\r' '\n' | tr \' \" | sed -n
>> 's/.*url="\([^"]*\)".*/\1/p'
> If your problem is getting a python string without worrying about how to
> escape the escape sequences, try:
> 
> r"""wget -q www.anywebpage.com -O - | tr '\r' '\n' | tr \' \" | sed -n
> 's/.*url="\([^"]*\)".*/\1/p'"""
> 
> You should be able to pass this directly to a popen() function.

Hi,

Thanks for replying however I have just tried that and it does not seem to
work, it doesnt return any results (i take it the r was a typo)

Thanks

RiGGa



More information about the Python-list mailing list