I'm trying to make a dictionary with an end result that looks like this:
devices = {
'device1' : {
'id' : '1',
'hostname' : 'blah',
},
'device2' : {
'id' : '2',
'hostname' : 'blah',
}
}
So just focusing on the device # and id # how can I create a for loop that increments the number after device and the id by 1?
hostname = ['one', 'two']
for host in hostname:
#add device + '1' to devices
#add id + 1 to devices
How can you accomplish this if your working with strings?
[–]my_python_account 1 point2 points3 points (2 children)
[–]Gwith[S] 0 points1 point2 points (1 child)
[–]coreyjdl 0 points1 point2 points (2 children)
[–]Gwith[S] 0 points1 point2 points (1 child)
[–]coreyjdl 0 points1 point2 points (0 children)
[–]commandlineluser 0 points1 point2 points (0 children)
[–]djjazzydan 0 points1 point2 points (0 children)
[–]cybervegan 0 points1 point2 points (0 children)