I want to insert a variable in place of the ip address this is my working code without the variable:
subprocess.call(r'net use T: \\192.168.1.10\myshare /PERSISTENT:YES', shell=True)
this is my not workings attempts with the variable:
myip = "192.168.1.10"
subprocess.call(r'net use T: \\'+myip'\myshare /PERSISTENT:YES', shell=True)
#or:
subprocess.call(r'net use T: \\', 'myip', '\myshare /PERSISTENT:YES', shell=True)
#or:
subprocess.call(r'net use T: \\'+myip+'\myshare /PERSISTENT:YES', shell=True)
#or:
subprocess.call(r'net use T: \\+myip+\myshare /PERSISTENT:YES', shell=True)
none of these works any suggestions?
subprocess.call(r'net use T: \\'+myip+'\myshare /PERSISTENT:YES', shell=True)) should have worked. Did you get any error message?rprefix.