convert ints in a range to strings

hokiegal99 hokiegal99 at hotmail.com
Wed Sep 17 20:48:18 EDT 2003


Thanks Heather... this did it:

outputFile = file('ips.txt', 'w')
r = range(256)
for r in range(256):
    f = '192.168.1.%s\n' % r #Change this line to macth your network.
    outputFile.write(f)
outputFile.close()

Heather Coppersmith wrote:
> Try any or all of these:
> 
>     print a + b + c + str( r )
> 
>     print a + b + c + "%d" % r
> 
>     print a + b + c + "%s" % r
> 
>     print "%s%s%s%d" % (a, b, c, r)
> 
> Regards,
> Heather
> 






More information about the Python-list mailing list