Python Forum
Thread Rating:
  • 2 Vote(s) - 1.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
List logic
#11
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 ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '+', '=', '~', '`', '{', '}', '|', '[', ']', ':', ';', '"', '<', ',', '.', '>', '/', ' ', '?', '\\']
Reply


Messages In This Thread
List logic - by Low_Ki_ - Apr-22-2017, 02:03 AM
RE: List logic - by Low_Ki_ - Apr-22-2017, 03:08 AM
RE: List logic - by ichabod801 - Apr-22-2017, 10:50 AM
RE: List logic - by Low_Ki_ - Apr-22-2017, 04:56 PM
RE: List logic - by idontreallywolf - Apr-22-2017, 11:10 AM
RE: List logic - by tomhath - Apr-22-2017, 03:41 PM
RE: List logic - by ichabod801 - Apr-22-2017, 05:44 PM
RE: List logic - by Low_Ki_ - Apr-22-2017, 06:53 PM
RE: List logic - by ichabod801 - Apr-22-2017, 09:24 PM
RE: List logic - by Low_Ki_ - Apr-22-2017, 11:46 PM
RE: List logic - by Low_Ki_ - Apr-23-2017, 02:29 AM
RE: List logic - by wavic - Apr-23-2017, 04:21 AM
RE: List logic - by Low_Ki_ - Apr-23-2017, 04:31 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020