Thanks for the tip about the CSV module. I did not know about that.
Here are two lines from the CSV file:
,,172.20.{0}.0/27,172.20.{0}.32/27,172.20.{0}.64/27,29,172.20.{0}.96/27,,,,172.21.{0}.0/27,172.21.{0}.32/27,172.21.{0}.64/27,29,172.21.{0}.96/27
GW:,,172.20.{0}.1,172.20.{0}.33,172.20.{0}.65,,172.20.{0}.97,,GW:,,172.21.{0}.1,172.21.{0}.33,172.21.{0}.65,,172.21.{0}.97
This is the output:
,,,,,,,,,,,,,,
,,,,,,,,,,,,,,
GW:,,172.20.126.129,172.20.126.161,172.20.126.193,,172.20.126.225,,GW:,,172.21.126.129,172.21.126.161,172.21.126.193,,172.21.126.225
''''''''''''''''''
There are blank lines between and I am assuming that these are from newlines being introduced.
The idea of this script is/was to abstract the csv data so that I dont need to place them in the file as there are many seperate CSV files to import.
I hope I answered your questions.
The majority of the script is below.
#!/usr/bin/python
import sys, os
#import pdb
#pdb.set_trace()
f=open('europe_germanyfinalcsv')
lines=f.readlines()
BU = 'Europe Germany,,,,,,,,,,,,,,'
PPP = 'Pre-Prod,,,,,,,,Prod,,,,,,'
C1 = ',,,,,,,,,,,,,,'
Title = 'Site,Environment,vApp Web,vApp App,vApp Data,Hosts Per Net,Reserved,,Site,Environment,vApp Web,vApp App,vApp Data,Hosts Per Net,Reserved'
NET1 = lines[4]
GW1 = lines[5]
M1 = lines[6]
PS1 = lines[7]
PE1 = lines[8]