You haven't actually used the
If you wanted to use
but... don't do that.
Just check the length:
No need for regular expressions here at all.
re
module here.If you wanted to use
re
you would need to change your conditional to something like:if re.match("^[a-z]{8}$", username):
but... don't do that.
Just check the length:
if len(username) == 8 and username.isalpha():
No need for regular expressions here at all.