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

c# SetCompatibleTextRenderingDefault must be called before the first -

c++ - Fill runtime data at compile time with templates -

C#.NET Oracle.ManagedDataAccess ConfigSchema.xsd -