本文整理匯總了Python中Function.get_mask方法的典型用法代碼示例。如果您正苦於以下問題:Python Function.get_mask方法的具體用法?Python Function.get_mask怎麽用?Python Function.get_mask使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Function
的用法示例。
在下文中一共展示了Function.get_mask方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: print
# 需要導入模塊: import Function [as 別名]
# 或者: from Function import get_mask [as 別名]
host_id.append(int(32 - math.log(int(subnet[i]), 2)))
print(host_id)
'''
ip_block = []
for i in range(0, int(num_subnet)):
ip_block.append(ip_address + "/" + str(host_id[i]))
print(ip_block)
'''
#network 0
ip_block = ip_address + "/" + str(host_id[0])
print("Network 0: ")
print("- Network address: " + str(f.get_network(ip_block)) + "/" + str(host_id[0]))
print("- Broadcast: " + str(f.get_broadcast(ip_block)))
print("- Subnet mask: " + str(f.get_mask(ip_block)))
first_host, last_host = f.get_range(ip_block)
print("- Range host: " + str(first_host) + " -> " + str(last_host))
print()
ip_address = f.get_broadcast(ip_block) + 1
for i in range(1, int(num_subnet)):
ip_block = str(ip_address) + "/" + str(host_id[i])
print("Network " + str(i) + ": ")
print("- Network address: " + str(f.get_network(ip_block)) + "/" + str(host_id[i]))
print("- Broadcast: " + str(f.get_broadcast(ip_block)))
print("- Subnet mask: " + str(f.get_mask(ip_block)))
first_host, last_host = f.get_range(ip_block)
print("- Range host: " + str(first_host) + " -> " + str(last_host))
print()