'I want to make list of all ipv4 addresses around the globe

I don't understand networking. I wrote this code but I need a faster solution. Anyone got any ideas? Thank you Code:

for i in range(0, 256):
  for j in range(0, 256):
      for k in range(0, 256):
        for l in range(0, 256):
          print("{}.{}.{}.{}".format(i, j, k, l))
          with open("ip_2.txt", "a") as f:
            f.write("{}.{}.{}.{}\n".format(i, j, k, l))

Thanks again.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source