Apr-23-2017, 02:29 AM
so here is another one... how do I get the \ in invalidChars list without it showing up as double \\
def getUserInfo(): while True: print('Enter a valid username: ') username = input() invalidChars = '!@#$%^&*()+=~`{}|[]:;"<,.>/ ?\\' invalidList = [] for l in invalidChars: invalidList.append(l) print(invalidList) break getUserInfo()
Output:Enter a valid username:
f
['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '+', '=', '~', '`', '{', '}', '|', '[', ']', ':', ';', '"', '<', ',', '.', '>', '/', ' ', '?', '\\']