Advertisement
jemini972

Username Validity Checker

Jan 12th, 2020
734
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. import re
  2.  
  3. pts=0
  4. a={
  5.     1:"May only consist of alphanumeric characters",
  6.     2:"This username is valid",
  7.    }
  8. b=0
  9.  
  10. username=input("")
  11.  
  12. alnum=re.search(r"\W" or r"\s",username )
  13.  
  14. if not alnum:
  15.     pts+=1
  16.     b=2
  17. if alnum:
  18.      b=1
  19.  
  20. print("Username:",username )
  21. if pts==    1:
  22.     print(a[b])
  23. else:
  24.     print(a[b])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement