I'm trying to make a simple script to rip dvds for me, but my experience isn't great enough to know how to do what I'm trying to do. I have this script:
import os
a=raw_input("What is the name of the disk? ")
b=input("Which disk is this? ")
os.system("c:\dvddecrypter.exe /MODE isoread /SRC G: /dest e:\Misc\Dvd Rips\%variableA%\%variableA% Disk %variableB%.iso /split NONE /OVERWRITE YES /DIRECT * /start /CLOSE")
I want to change the switches/arguments that the script passes to dvd decrypter based on my answers to the first two inputs. So the script would ask me "What is the name of the disk?" and then I'd say "Battlestar Galactica Season 2" and then the script would ask me which disk it was and I'd answer "2". The script then calls dvd decrypter with certain arguments/switches based on those two variables and so tells it to save the ISO as "e:\Misc\Dvd Rips\Battlestar Galactica Season 2\Battlestar Galactica Season 2 Disk 2.iso"
So how do I insert those variables into just those 3 parts of the argument?
Simplest way if you only care about using the script on your own computer is to use basic string concatenation (using +) like the following. You're dvddecryptor program probably needs paths/filenames enclosed in their own quotes (so with spaces it is still considered one string) - take out the double-quotes if I'm wrong. A neat thing about python is that you can use single or double quotes to delimit a string so you don't need to escape-sequence the other type of quote. To get fancier and check your input etc, look up os.path in the python help.
I would have posted an answer myself, but it seemed like a much better idea for you to figure out for yourself how to use variables rather than to just hand you an answer. After all, give a man fire, and he's warm for a night. Set a man on fire, and he's warm for the rest of his life.
"preemptive killing of cops might not be such a bad idea from a personal saftey[sic] standpoint..." --Keevan Colton
"There's a word for bias you can't see: Yours." -- William Saletan