dimanche 25 juillet 2021

expected string or bytes-like object when import re

i have code

expected_letters = [6,7,8]
if len(license_plate)= expected_letters:  
   return True

if re.match("[A-Z][0-9][0-9][0-9][0-9][A-Z]", license_plate):
    return True
    
if re.match("[A-Z][0-9][0-9][0-9][0-9][A-Z][A-Z]", license_plate):
    return True

if re.match("[A-Z][0-9][0-9][0-9][0-9][A-Z][A-Z][A-Z]", license_plate):
    return True

else:
    return False

code if len(licence_plate) is it true?

when i run if re.match there is error: re.py - return _compile(pattern, flags).match(string)

TypeError: expected string or bytes-like object

how to fix this?

Aucun commentaire:

Enregistrer un commentaire