forked from bajuba/FileProcessingFunctionsTool
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenuFunction.py
More file actions
113 lines (109 loc) · 4.01 KB
/
menuFunction.py
File metadata and controls
113 lines (109 loc) · 4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import tools
#Menu description
menuOptions = {
1: "Choose a different file to change",
2: "add input to file",
3: "capitalize all letters in file",
4: "remove spaces from file",
5: "remove all instances of the word 'the' from file",
6: "reverse the file",
7: "double the file",
8: "remove every other character from the file",
9: "sum all numbers in the file",
10: "replace every character in the file with it's ascii value",
11: "remove every character except a,b,c and space from the file",
12: "Capitalize every third letter in the file",
13: "double every contiguous number in the file",
14: "add ' ever since the incident' before each '.' in the file",
15: "add random amounts of random characters randomly throughout the file",
16: "alphabetize the file",
17: "search the file for a string",
18: "add a line return after each '.' in the file",
19: "implement a replace all for a matched string in the file",
20: "add rick astley lyrics to the file",
21: "return the number of characters in the file",
22: "implement a replace all",
23: "make a copy of the file",
24: "combine two files",
25: "separate the file into two files",
26: "add your own idea"
}
#Menu functionality: Call functions here
def menuUse(choice):
#Use tools.filename to access the most recent filename
while choice != "q":
if choice == "1":
tools.chooseFile()
elif choice == "2":
print("In Progress")
elif choice == "3":
tools.capitalizeAllLetters(tools.filename)
elif choice == "4":
tools.removeSpaces(tools.filename)
elif choice == "5":
tools.remove_the(tools.filename)
elif choice == "6":
tools. reverseFile(tools.filename)
elif choice == "7":
print("In Progress")
elif choice == "8":
tools.removeEveryOtherChar(tools.filename)
elif choice == "9":
print("In Progress")
elif choice == "10":
#tools.capitalizeAllLetters(tools.filename)
tools.replaceCharacterWithAscii(tools.filename)
print("In Progress")
elif choice == "11":
tools.abcSpace(tools.filename)
elif choice == "12":
tools.capitalize_every_third(tools.filename)
elif choice == "13":
tools.double_contiguous_numbers(tools.filename)
elif choice == "14":
tools.the_incident(tools.filename)
elif choice == "15":
tools.add_random_char(tools.filename)
elif choice == "16":
tools.alphabetize_file(tools.filename)
elif choice == "17":
tools.searchStr(tools.filename)
elif choice == "18":
print("In Progress")
elif choice == "19":
tools.replaceString(tools.filename)
elif choice == "20":
tools.rickAstley(tools.filename)
elif choice == "21":
print("In Progress")
elif choice == "22":
tools.replaceAll(tools.filename)
elif choice == "23":
tools.copy_file(tools.filename)
elif choice == "24":
print("In Progress")
elif choice == "25":
tools.splitFile(tools.filename)
elif choice == "26":
print("In Progress")
elif choice == "q":
print("I hope we solved your problem!")
exit()
else:
print("Please enter a valid response.")
input("Press enter to continue...")
printMenu()
choice = input("\nWhat would you like to do?\n")
#Prints all menu Options
def printMenu():
#For each key value pair in the menuOptions dictionary, print it out
for key in menuOptions.keys():
print (key, '--', menuOptions[key] )
print("Enter 'q' to quit." )
#Menu Start
def menu():
print("\nChoose how you would like to use your files.")
tools.chooseFile()
printMenu()
choice = input("\nWhat would you like to do?\n")
menuUse(choice)