I want to pass a string to a variable to a string, which in turn gets passwd onto a function. I had written the code below:
Not Working
env = 'D'
myFunction("Checking Processes A%s/B%s",'')% (env,env)
error
myFunction("Checking Processes A%s/B%s",'')% (env,env)
TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'
Since the code failed I re-wrote it as below:
Working
env = 'D'
str = "Checking Processes A%s/B%s" %(env,env)
myFunction(str,'')
Can anyone suggest any alternative shorter approaches to this ?Ideally in lines of my first attemp which would mean less LOC.