python - Why do these two command give different outputs? -


command 1:

subprocess.call(["echo","\"hw\""]) 

output:

"hw" 

command2 :

subprocess.call(["echo","""hw"""]) 

output:

hw 

your first command passes quotes echo system command, , equivalent doing on command line:

$ echo "hw" 

your second command passes hw string (no quotes) echo , equivalent following:

$ echo hw 

in second command, you're using docstring notation strings, equivalent "hw" 'hw'.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -