Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import itertools
- import sys
- def func(value):
- value_len = len(value)
- new_value = ''
- for i in range(value_len):
- if i == value_len - 1:
- new_value += value[i]
- else:
- new_value += value[i] + '-'
- max_dots = value_len - 1
- indexes = []
- for i in range(max_dots):
- indexes.append(i * 2 + 1)
- for i in range(max_dots):
- combinations = itertools.combinations(indexes, i + 1)
- for combination in combinations:
- output = new_value
- for index in indexes:
- if index in combination:
- output_list = list(output)
- output_list[index] = '.'
- output = ''.join(output_list)
- output = output.replace('-', '')
- print(output)
- if len(sys.argv) == 2:
- string = sys.argv[1]
- if string.isalnum():
- func(string)
- else:
- print('Input must be alphanumeric')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement