Last active
October 17, 2018 15:47
-
-
Save XChrisUnknownX/dce555fced5fdf8c6d84baed195050dd to your computer and use it in GitHub Desktop.
Sorts txts that are in the format of chammy.txt or chammy2.txt
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
#If the program works correctly you should be able to give it a txt with a word on each line and it should give you a new txt with the words sorted alphabetically. | |
filename = input("Specify txt you wish to sort: ") | |
with open(filename,"r") as sortfile, open("Sorted File.txt","x") as newfile: | |
newstring = sortfile.read() | |
newlist = newstring.split() | |
newlist.sort() | |
for n in newlist: | |
newfile.write(n) | |
newfile.write(""" | |
""") |
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
walrus | |
makeup | |
realize | |
artichoke | |
amnesty | |
gamer | |
play | |
pork | |
hand | |
land | |
fanned | |
cramped | |
joker | |
box | |
go | |
try | |
mark | |
fall | |
lose | |
loser | |
start | |
restart | |
preliminary |
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
walrus makeup realize artichoke amnesty gamer play pork hand land fanned cramped joker box go try mark fall lose loser start restart preliminary |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment