SHARE
TWEET

Chris code

a guest Apr 5th, 2020 36 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import csv
  2.  
  3. ipAddressSpreadsheet = open('G:\\Downloads\\list_of_sites.csv')
  4. spreadsheetReader = csv.reader(ipAddressSpreadsheet)
  5. spreadsheetData = list(spreadsheetReader)
  6.  
  7.  
  8. with open('G:\\Downloads\\results.txt','w') as file1:
  9.  
  10.  
  11.     restaurant_dict = {}
  12.  
  13.     for item in range(len(spreadsheetData)):
  14.         add = spreadsheetData[item][0]
  15.         name = spreadsheetData[item][1].replace(" ","")
  16.  
  17.         if name in restaurant_dict.keys():
  18.             restaurant_dict[name].append(add)
  19.         else:
  20.             restaurant_dict[name]  = [add]
  21.  
  22.     for name,add_list in restaurant_dict.items():
  23.         for x in range(len(add_list)):
  24.             file1.write('set security address-book global address RESTAURANTS_{name}_{iteration} {add}\n'.format(name=name, iteration=x, add=add_list[x]))
  25.             file1.write('set security address-book global address-set Customer_{name} address RESTAURANTS_{name}_{iteration}\n'.format(name=name, iteration=x))
  26.  
  27.     print('All done!')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top