Skip to content

Instantly share code, notes, and snippets.

@yarkovaleksei
Last active April 21, 2017 23:12
Show Gist options
  • Save yarkovaleksei/86c4ce37e6c054264009f824e566df6c to your computer and use it in GitHub Desktop.
Save yarkovaleksei/86c4ce37e6c054264009f824e566df6c to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
names_file = 'names.txt'
father_names_file = 'father_names.txt'
combinations_file = 'combinations.txt'
def main():
with open(combinations_file, 'w') as combinations:
with open(names_file, 'r') as names, open(father_names_file, 'r') as father_names:
names_lines = names.readlines()
father_names_lines = father_names.readlines()
for name in names_lines:
for father_name in father_names_lines:
line = "%s %s" % (name.replace("\n", ""),
father_name.replace("\n", ""))
combinations.write("%s\n" % line)
if __name__ == '__main__':
main()
Иванович
Степанович
Иван
Степан
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment