Python
- 24 ответа
- 0 вопросов
13
Вклад в тег
import itertools
s = '197.1-10.197.*'
sections = s.split('.')
addresses = []
for i in sections:
if '-' in i:
min,max = i.split('-')
a = [x for x in range(int(min),int(max))]
elif '*' in i:
a = [x for x in range(0,255)]
else:
a = [int(i)]
addresses.append(a)
addresses = itertools.product(*addresses)
for i in addresses:
print i