Dec-01-2017, 09:31 PM
#######I am trying to create multiple .cfg files. I need a new file every time the string apCode changes. Currently, it will spit out 1 file. Also, the file that it spits out shows to be .cfg but the device that is supposed to accept the file, does not recognize it.#####
######################################## User Input #########################################################################
import time
tName = input ("What is the Name of the Tower?--->")
antType = input ("What Type of Antennas are Being Used?--->")
numAps = int(input ("How Many APs are Going on the Tower?--->"))
gateWay = input ("Enter the Gateway for the APs--->")
notused = input ("Press Enter to Continue--->")
apCode = (0)
########################################AP Information#######################################################################
apIp = (gateWay[:-1]+"10")
apAzmath = int(360 / numAps)
apDirection = ("%03d" % apCode)
fileName = (tName +"-"+ apDirection)
apConfig = ("""the config goes here""")
######################################## File Writing ###########################################################################
while apCode < (numAps * apAzmath - apAzmath):
f = open (fileName+".cfg","w+")
f.write (apConfig.format(apIp,antType,apDirection,tName,gateWay,tName,antType,apDirection,tName,antType,apDirection,tName))
f.close ()
time.sleep (2)
apCode = (apCode + apAzmath)
I am 4 days into learning Python. I am sure that there are things in here that will make you guys cringe. Sorry
######################################## User Input #########################################################################
import time
tName = input ("What is the Name of the Tower?--->")
antType = input ("What Type of Antennas are Being Used?--->")
numAps = int(input ("How Many APs are Going on the Tower?--->"))
gateWay = input ("Enter the Gateway for the APs--->")
notused = input ("Press Enter to Continue--->")
apCode = (0)
########################################AP Information#######################################################################
apIp = (gateWay[:-1]+"10")
apAzmath = int(360 / numAps)
apDirection = ("%03d" % apCode)
fileName = (tName +"-"+ apDirection)
apConfig = ("""the config goes here""")
######################################## File Writing ###########################################################################
while apCode < (numAps * apAzmath - apAzmath):
f = open (fileName+".cfg","w+")
f.write (apConfig.format(apIp,antType,apDirection,tName,gateWay,tName,antType,apDirection,tName,antType,apDirection,tName))
f.close ()
time.sleep (2)
apCode = (apCode + apAzmath)
I am 4 days into learning Python. I am sure that there are things in here that will make you guys cringe. Sorry