if using 3.6+ use f-strings
subprocess.run(['netsh', 'interface', 'set', 'interface', 'name="Wi-Fi"', f'newname="{changeName}"'])if using lower version
subprocess.run(['netsh', 'interface', 'set', 'interface', 'name="Wi-Fi"', 'newname="{}"'.format(changeName)])for greater readability you may want to make this before the call
import subprocess change_name = input("Enter the Interface name:") new_name = 'newname="{}"'.format(change_name) # new_name = f'newname="{change_name}"' subprocess.run(['netsh', 'interface', 'set', 'interface', 'name="Wi-Fi"', new_name]) subprocess.run(['netsh', 'interface', 'show', 'interface'])don't use
os.system
- it's depreciated, use subprocess.call
or even better subprocess.run
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs