I want to pass two variables to the os.system() for example listing files in different format in specific directory like (ls -l testdirectory) in which both a switch and test di
you are asking about string formating (since os.system takes a string, not a list of arguments)
os.system
cmd = "ls -{0} -{1}".format(var1,var2) #or cmd = "{0} -{1} -{2}".format("ls","l","a") os.system(cmd)
or
cmd = "ls -%s -%s"%(var1,var2)
cmd = "ls -"+var1+" -"+var2