Created
June 16, 2019 18:38
-
-
Save Den1al/1fdfb87592761df9c5cb0eb46375f93b to your computer and use it in GitHub Desktop.
Generate Israeli Phone Numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import product | |
from string import digits | |
prefixes = ["050", | |
"051", | |
"052", | |
"053", | |
"054", | |
"055", | |
"056", | |
"058", | |
"059"] | |
def generate_numbers(): | |
for prefix in prefixes: | |
for p in product(digits, repeat=7): | |
suffix = ''.join(p) | |
yield f'{prefix}{suffix}' | |
def main(): | |
with open('phone_numbers.dict', 'w') as f: | |
for number in generate_numbers(): | |
f.write(f'{number}\n') | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment