I'm trying to create a script that will grab host names and IP addresses and write them to a list that I can zip into a separate dictionary. It's working aside from the fact that I don't have any numbers in the variable I just get the '.' portion and not the number. Not really sure what I'm doing wrong as this hasn't happened to me before...Take a look:
HOST_NAME = []
IP_ADDRESS = []
ADDITION_NAME = "Please enter a word or two explaining the addition (used for file name): "
ENTRY_AMOUNT = int(input("How many hosts will need records? "))
for number in range(ENTRY_AMOUNT):
hostname = raw_input("What is the hostname of the host: ")
address = raw_input("What is the IP address of the host: ")
HOST_NAME.append(hostname)
IP_ADDRESS.append(IP_ADDRESS)
A_RECORD_ENTRY = dict(zip(HOST_NAME,IP_ADDRESS))
print HOST_NAME # test for correct appendages
print IP_ADDRESS # test for correct appendages
print A_RECORD_ENTRY # testing code for dictionary output
This is giving me the output of:
C:\Users\fallacy>a_record_add.py
How many hosts will need records? 1
What is the hostname of the host: test
What is the IP address of the host: 192.168.1.1
['test']
[[...]]
{'test': [[...]]}
It adds just the dots as stated I haven't ran into this before so please let me know what I am doing incorrectly! Much appreciated!
IP_ADDRESS.append(IP_ADDRESS)
I think you meant to write:
IP_ADDRESS.append(address)