convert ints in a range to strings

hokiegal99 hokiegal99 at hotmail.com
Thu Sep 18 02:48:18 CEST 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