'How to convert datetime format '%a, %d %b %Y %H:%M:%S %z' in python?

I'm trying to convert a string to datetime and keep getting the error:

ValueError: time data 'Sat, 14 May 2022 12:15:00 +0000' does not match format '%a, %d %b %Y %H:%M:%S %z'

import datetime

format = '%a, %d %b %Y %H:%M:%S %z'
date = datetime.datetime.strptime('Sat, 14 May 2022 12:15:00 +0000', format)
print(date)

What is wrong with my code?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source