I'm not sure what you're trying to do here:
"echo' " ""
… but here's how Python will interpret it:
First, "echo' "
is a 6-character string (the word echo
, a single '
, and a space). Then ""
is an empty string. These are concatenated together (forming the same 6-character string, of course).
If you want to put double-quote characters into a double-quoted string, you have to escape them with a backslash, like this:
"echo' \" \""
However, there's a much, much easier way to deal with this stuff: just using triple-quoting. Most people learn about triple-quoting as a way to handle multi-line strings, and it is great for that—but it's also great for strings that have both kinds of quotes inside:
'''echo' " "'''
Also, instead of opening and closing the quotes over and over again so you can use string concatenation, it's a lot simpler to use a single format string and call format
on it (or, if you prefer, to use the %
operator).
But meanwhile, if what you're trying to send is this:
echo "junk junk:/vol/junk"
I have no idea why you're starting off with echo'
as the start of the string, but you've clearly gone wrong right off the bat. What you want is something like:
'''echo "{0} {1}"'''.format(mtpt, filervol)
I put 5 spaces there because your original code had a 2-space string added to a 3-space string. But your desired output has 14 spaces, so… I'm not sure what you actually want there. If there were tabs involved in your actual code that got lost in copy-pasting to StackOverflow, I'd recommend using \t
escapes in your literals instead of actual tabs.