Validate an ISO-8601 datetime string in Python?
问题 I want to write a function that takes a string and returns True if it is a valid ISO-8601 datetime--precise to microseconds, including a timezone offset-- False otherwise. I have found other questions that provide different ways of parsing datetime strings, but I want to return True in the case of ISO-8601 format only. Parsing doesn't help me unless I can get it to throw an error for formats that don't match ISO-8601. (I am using the nice arrow library elsewhere in my code. A solution that