I'm currently working with RaspberryPi-3 with Rasbian installed. I want to auto-reconnect to a network to a specific network. Going through the internet, I found out a way to do it i.e. by editing the interfaces file under /etc/network. I want to edit this file using some script (preferably Python-3). I just need to add these lines to the interfaces file:
auto wlan0
iface wlan0 inet dhcp
wpa-ssid <my-SSID>
wpa-psk <my-PassKey>
Please help me regarding this issue.
/etc/networkis outdated since Debian/Raspian Jessie. The setting should be done via/etc/wpa_supplicant/wpa_supplicant.conf.