String operations

Anoop Rajendra arajendr at cse.uta.edu
Wed Dec 1 23:20:02 CET 2004


Hi. I'm trying to resolve an issue with strings.

The command(inclusive of the back-slashes)

condor_q -l -constraint "ProjectId==\"anoopr_samadams.fnal.gov_161903_30209\""

is the only way the command returns the right result. 
I'm trying to run this command from inside a python program.
The way I can get it work is by: 

os.system('condor_q -l -constraint "ProjectId==\\\"anoopr_samadams.fnal.gov_161903_30209\\\""')

But, I'd rather use the os.exec functions to get the output. But 

os.execvp("condor_q",["condor_q","-l","-constraint",'"ProjectId==\\\"anoopr_samadams.fnal.gov_161903_30209\\\""'])

doesnt work. Its definately a problem with one of the million
backslashes and quotes present, but I'm not able to figure it out.
What am I doing wrong?

Thanks,
Anoop ///
________________________________________________
The happiest time of a person's life is after his first divorce.
          -- J.K. Galbraith 





More information about the Python-list mailing list