View Single Post
  #6  
Old 05-07-2019, 02:53 AM
ogun ogun is offline
Registered User
 
Join Date: Sep 2013
Posts: 15
The canonical way would probably be something like:
Code:
# $language = "python"
# $interface = "1.0"
#
KeyStr = ["<IP_ADDRESS>","<PREFIXLENGTH>","<HOSTNAME>"]
AssignStr = ["10.10.10.10","24","blahblah"]

Dict_Param = dict(zip(KeyStr, ValueStr))
Though it looks like you are parsing a csv file, in which case I would probably look into the csv module available in the standard library, more specifically the DictReader class. See here for details: https://docs.python.org/2.7/library/...csv.DictReader
Reply With Quote