Skip to content

Commit f591389

Browse files
author
Will Roberts
committed
README: document __init__-level import
1 parent c05d615 commit f591389

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

README.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ A small Python library to parse various kinds of time expressions,
1111
inspired by
1212
`this StackOverflow question <http://stackoverflow.com/questions/4628122/how-to-construct-a-timedelta-object-from-a-simple-string>`_.
1313

14-
The single function ``timeparse`` defined in the module parses time
14+
The single function ``pytimeparse.timeparse.timeparse`` defined in the
15+
library (also available as ``pytimeparse.parse``) parses time
1516
expressions like the following:
1617

1718
- ``32m``
@@ -51,17 +52,17 @@ expressions like the following:
5152
It returns the time as a number of seconds (an integer value if
5253
possible, otherwise a floating-point number)::
5354

54-
>>> from pytimeparse.timeparse import timeparse
55-
>>> timeparse('1.2 minutes')
55+
>>> from pytimeparse import parse
56+
>>> parse('1.2 minutes')
5657
72
5758

5859
A number of seconds can be converted back into a string using the
5960
``datetime`` module in the standard library, as noted in
6061
`this other StackOverflow question <http://stackoverflow.com/questions/538666/python-format-timedelta-to-string>`_::
6162

62-
>>> from pytimeparse.timeparse import timeparse
63+
>>> from pytimeparse import parse
6364
>>> import datetime
64-
>>> timeparse('1 day, 14:20:16')
65+
>>> parse('1 day, 14:20:16')
6566
138016
6667
>>> str(datetime.timedelta(seconds=138016))
6768
'1 day, 14:20:16'

0 commit comments

Comments
 (0)