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

sql - can we replace full join with union of left and right join? why not? -

javascript - Parallax scrolling and fixed footer code causing width issues -

iOS: Performance of reloading UIImage(name:...) -