diff options
Diffstat (limited to 'tutorials')
-rw-r--r-- | tutorials/2.x/ip/sets.txt | 6 | ||||
-rw-r--r-- | tutorials/2.x/ip/tutorial.txt | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/tutorials/2.x/ip/sets.txt b/tutorials/2.x/ip/sets.txt index e38df64..e8bca57 100644 --- a/tutorials/2.x/ip/sets.txt +++ b/tutorials/2.x/ip/sets.txt @@ -42,7 +42,7 @@ IPSet(['0.0.0.0/0']) You can interate over all the IP addresses that are members of the IP set. >>> for ip in IPSet(['192.0.2.0/28', '::192.0.2.0/124']): -... print ip +... print(ip) 192.0.2.0 192.0.2.1 192.0.2.2 @@ -114,7 +114,7 @@ Here's an IP set. Now, let's iterate over the IP addresses in the arbitrary IP address range and see if they are found within the IP set. >>> for ip in iprange: -... print ip, ip in ipset +... print(ip, ip in ipset) 192.0.1.255 False 192.0.2.0 True 192.0.2.1 True @@ -235,7 +235,7 @@ Here's a more complete example using various well known IPv4 address ranges. Let's see what we've got: >>> for cidr in available.iter_cidrs(): -... print cidr, cidr[0], cidr[-1] +... print(cidr, cidr[0], cidr[-1]) 0.0.0.0/5 0.0.0.0 7.255.255.255 8.0.0.0/7 8.0.0.0 9.255.255.255 11.0.0.0/8 11.0.0.0 11.255.255.255 diff --git a/tutorials/2.x/ip/tutorial.txt b/tutorials/2.x/ip/tutorial.txt index fa234bc..79c8460 100644 --- a/tutorials/2.x/ip/tutorial.txt +++ b/tutorials/2.x/ip/tutorial.txt @@ -285,7 +285,7 @@ List reversal. Use of generators ensures working with large IP subnets is efficient. >>> for ip in IPNetwork('192.0.2.0/23'): -... print '%s' % ip +... print('%s' % ip) ... 192.0.2.0 192.0.2.1 @@ -302,7 +302,7 @@ In IPv4 networks you only usually assign the addresses between the network and b Here is the iterator provided for accessing these IP addresses : >>> for ip in IPNetwork('192.0.2.0/23').iter_hosts(): -... print '%s' % ip +... print('%s' % ip) ... 192.0.2.1 192.0.2.2 |