nailad
-
Modifié le 25 avril 2020 à 20:53
Whismeril
Messages postés19027Date d'inscriptionmardi 11 mars 2003StatutContributeurDernière intervention24 avril 2024
-
26 avril 2020 à 17:18
Bonjour,
je veux répondre à cette question "Write a Python program to find all Dates in a text (Both French Format and English Format )" mon code est le suivant:
def date_en_fr(text):
for match in re.findall(r"\d{2}/\d{2}/\d{4}", text):
print(match)
if date(match).isoformat() == '%m/%d/%Y':
print("Date is {}, in English format".format(match))
elif date(match).isoformat() == '%d/%m/%Y':
print("Date is {}, in French format".format(match))
else:
print("Date don't verify the both format")
print(date_en_fr("I have a meeting on 12/29/2019 in New York, an other on 02/14/2019 and the last on 29/12/2018 in Paris."))
est ce que pourriez-vous m'aider à le corriger?
A voir également:
Typeerror: an integer is required (got type str)
An integer is required (got type str) - Meilleures réponses
Typeerror an integer is required - Meilleures réponses
Whismeril
Messages postés19027Date d'inscriptionmardi 11 mars 2003StatutContributeurDernière intervention24 avril 2024656 Modifié le 26 avril 2020 à 15:56
Je ne code pas en Python, juste pour les questions simples sur le forum.
J'ai donc copié collé ton code dans un compilateur en ligne, ce compilateur me dit qu'à la ligne 2 la variable "re" n'existe pas.
Je pense que ton propre compilateur a du te signaler la même chose.