T
tgiles
Hi, all.
I'm YAPN (Yet Another Python Newbie), started messing with it last night
and so far, so good. Documentation exellent and the people seem friendly
enough
Ok, I started playing around with random() and decided to write a script
to generate random dotted quad IP addresses, just to see if I could do it.
Everything is perfect with the glaring exeception of the output. It seems
as if when one uses the "," in a print statement, you get an empty space
in between variables and what I want there (namely, the ".").
I've tried it several different ways with no go. Here's the script in all
her cheesy glory:
import random
n = 2
while n > 0:
a = random.randint(1,254)
b = random.randint(1,254)
c = random.randint(1,254)
d = random.randint(1,254)
print a,".",b,".",c,".",d
n = n-1
The output at the moment looks like so:
179 . 72 . 138 . 272
21 . 124 . 83 . 9
When, in a perfect universe it would look like so:
179.72.138.272
21.124.83.9
Thoughts on what critically simple something I missed?
Thanks for the input!
tom
I'm YAPN (Yet Another Python Newbie), started messing with it last night
and so far, so good. Documentation exellent and the people seem friendly
enough
Ok, I started playing around with random() and decided to write a script
to generate random dotted quad IP addresses, just to see if I could do it.
Everything is perfect with the glaring exeception of the output. It seems
as if when one uses the "," in a print statement, you get an empty space
in between variables and what I want there (namely, the ".").
I've tried it several different ways with no go. Here's the script in all
her cheesy glory:
import random
n = 2
while n > 0:
a = random.randint(1,254)
b = random.randint(1,254)
c = random.randint(1,254)
d = random.randint(1,254)
print a,".",b,".",c,".",d
n = n-1
The output at the moment looks like so:
179 . 72 . 138 . 272
21 . 124 . 83 . 9
When, in a perfect universe it would look like so:
179.72.138.272
21.124.83.9
Thoughts on what critically simple something I missed?
Thanks for the input!
tom