-1
Rotating the
os.system("reg add "caminho\caminho\caminho\caminho\"")
and if you can do more, you have a way for me to pick a word in the middle of that command and replace it with another??
-1
Rotating the
os.system("reg add "caminho\caminho\caminho\caminho\"")
and if you can do more, you have a way for me to pick a word in the middle of that command and replace it with another??
1
To use quotes within a string definition, you need to escape it with \
.
Thus:
"meu nome é \"wallace\"
The result will be:
'meu nome é "wallace"'
You could also replace double quotes with single quotes, to make this definition easier to read:
'meu nome é "Wallace"'
To replace a specific section, use the method replace
of his str
.
Thus:
'meu nome é Robin'.replace('Robin', 'Wallace')
The result will be:
'meu nome é Wallace'
To execute this command, I would not escape the string, and yes, I would use the str
, to improve readability, thus:
cmd = 'reg add "{0}"'.format("caminho\caminho\caminho")
os.system(cmd)
Or still using the operator %
to define the str
.
caminho = "caminho\caminho\caminho"
cmd = "reg add "%s"' % caminho;
Browser other questions tagged python string syslog
You are not signed in. Login or sign up in order to post.
Welcome to the site. Take a look at my answer and see if it helps you.
– Wallace Maxters