Skip to content

Instantly share code, notes, and snippets.

@satishgunjal
Created October 14, 2018 07:20
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save satishgunjal/b88af11483041ca538b4db4022c3360d to your computer and use it in GitHub Desktop.
Save satishgunjal/b88af11483041ca538b4db4022c3360d to your computer and use it in GitHub Desktop.
Get connected wifi SSID using python on Raspberry pi
import subprocess
try:
output = subprocess.check_output(['sudo', 'iwgetid'])
print("Connected Wifi SSID: " + output.split('"')[1])
except Exception, e:
print e
@albertoisorna
Copy link

albertoisorna commented Aug 5, 2022

I'd put :
output = subprocess.check_output(['sudo', 'iwgetid']).decode()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment