python generate ip's to selected files number -



python generate ip's to selected files number -

i want generate whole ip range , write many files user want this

how many files : 9 ip range : 100

i want split ip range 100.0.0.0 - 100.255.0.0 9 files 1.txt , 2.txt ... etc , write result files ... , remainder want write them in lastly file

result :-

file1: 100.0.0.0 100.1.0.0 100.2.0.0 100.3.0.0 ... 100.27.0.0 file2: 100.28.0.0 ... 100.55.0.0 , finish 9 files

i'm writing code process don't know how generate ip numbers

iprange = int(raw_input("ip range : ")) count = int(raw_input("how much files want create ? \n")) ipnum = 256 / count extra=256%count ipnum [-1]=ipnum [-1]+extra i,g in enumerate(ipnum): open('ip{0}_{1}'.format(iprange,(i+1)), 'w') fout: fout.writelines(?????)

any help

your schema want split not create total sense me. maybe can provide improve example. also, python's netaddr module help you.

python file text ip

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -