Message75913
| Author |
vstinner |
| Recipients |
amaury.forgeotdarc, belopolsky, jribbens, mark.dickinson, vstinner, webograph |
| Date |
2008年11月15日.12:36:08 |
| SpamBayes Score |
0.0007972063 |
| Marked as misclassified |
No |
| Message-id |
<200811151335.04167.victor.stinner@haypocalc.com> |
| In-reply-to |
<1226744760.36.0.834431885725.issue2706@psf.upfronthosting.co.za> |
| Content |
Some examples to help the choice (using the last patch).
int
---
2L
>>> print dt2 * 2
3:08:38
>>> print dt1 - dt2 * 2
0:51:22
>>> divmod(dt1, dt2)
(2L, datetime.timedelta(0, 3082))
>>> print timedelta(0, 3082)
0:51:22
In 4 hours, you can watch the movie twice, and then your have 51 minutes left.
Operations used:
- timedelta // timedelta
- timedelta * int
- divmod(timedelta, timedelta)
float
-----
0.21258172822053367
>>> "Progress: %.1f%%" % ((dt1 / dt2) * 100.0)
'Progress: 21.3%'
>>> dt2 * 0.75
...
TypeError: unsupported operand type(s) for *: 'datetime.timedelta' and 'float'
>>> print (dt2 * 3) // 4
1:10:44.250000
If you are seen this movie since 20 minutes, you're at 21% of the total. If
you want to jump to 75%, it will be at 1:10:44.
Note: timedelta * float is not implemented yet.
Operations used:
- timedelta / timedelta
- timedelta * int and timedelta // int (because timdelta / float is
not implemented yet) |
|