Last active
June 5, 2019 06:44
-
-
Save nickgrier07/704fd8916eb1e7f5591f5b493a88a493 to your computer and use it in GitHub Desktop.
File Edit Test
This file contains hidden or 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
| green apple | |
| yellow flower | |
| red mitten | |
| happy days | |
| white river |
This file contains hidden or 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
| def main(): | |
| extra_lines = ["Bald Mountain\n", "Albuquerque NM\n", "Blue Eagles\n"] # lines to be added | |
| with open('Alph.txt', 'r', encoding="UTF-8") as in_file: # saves lines from file as list | |
| file_lines = list(in_file) | |
| pre_saved_lines = file_lines + extra_lines | |
| saved_lines = sorted(pre_saved_lines) | |
| with open('Bet.txt', 'w', encoding="UTF-8") as out_file: # writes the new lines to a file | |
| for line in saved_lines: | |
| out_file.write(line) | |
| if __name__ == '__main__': # initializer | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment