Period.of#

static Period.of(period_string)[source]#

Return a Period from the supplied string.

Tries each supported string format in turn (plain ISO 8601 duration, the extended “+offset” form, and “<start>/<duration>”) and returns the first that matches.

Parameters:

period_string (str) – A string containing a period definition

Return type:

Period

Returns:

A Period object defined by the supplied string

Raises:

PeriodParsingError – If the string does not match any supported period format.