Getting "ValueError: need more than 1 value to unpack" while trying to read a value from dictionary in python

Sum J sjsumitj at gmail.com
Thu Feb 15 06:07:01 EST 2018


Below is my code. Here I want to read the "ip address" from s


 s= '''
    Power On Enabled = On
    State: connected
    Radio Module: Unknown
    noise: -097
    signalStrength: -046
    ip address: 192.168.75.147
    subnet mask: 255.255.255.0
    IPv4 address configured by DHCP
    Mac Addr: ac:e2:d3:32:00:5a
    Mode: infrastrastructure
    ssid: Cloudlab
    Channel: 1
    Regulatory: World Safe
    Authencation: WPA2/PSK
    Encryption:  AES or TKIP
    '''

   s = s.replace("=",":")
   # s = s.strip()
   print s

  d = {}
  for i in s:
     key, val = i.split(":")
     d[key] = val.strip()

  print d
  print d["ip address"]


Getting below error :
<module> key, val = i.split(":")
ValueError: need more than 1 value to unpack



More information about the Python-list mailing list