In Python, what should I do if I want to generate a random string in the form of an IP address?
For example: \"10.0.1.1\", \"10.0.3.14\",
\"10.0.1.1\"
\"10.0.3.14\"
An alternative way to generate a random string in the form of an IP address is:
>>> ip = '{}.{}.{}.{}'.format(*__import__('random').sample(range(0,255),4)) >>> ip '45.162.105.102'