"hyou" <hyo...@hotmail.com> wrote in message news:blu143-ds478a37dc2b1db050e5b96c4...@phx.gbl...
Hello,

I'm trying to write a script that simply execute a command line like:

C:\...(path)..\Devenv solution /build "Debug|Win32"

However, in Python the "|" symbol is reserved thus I just can't make the
command line above working once I added the "|" sign in it.

How can I put the "original" vertical bar in a string?

Without an example of the code you are using, my guess is you are using os.system to execute a command on Windows. The Windows shell (cmd.exe) uses veritical bar for the pipe command, which sends output from one program into the input of another. The caret(^) is used in the Windows to escape special characters. Example:

import os
os.system('echo Hello|World')
'World' is not recognized as an internal or external command,
operable program or batch file.
255
os.system('echo Hello^|World')
Hello|World
0


-Mark


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to