回答編集履歴
2
修正
answer
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
xは[timedeltaオブジェクト](https://docs.python.jp/3/library/datetime.html#timedelta-objects)です。
|
2
|
+
リンク先の次の表を見ると、秒部分は`x.seconds`で取得できることが分かります。
|
3
|
+
> インスタンスの属性 (読み出しのみ):
|
4
|
+
|属性|値|
|
5
|
+
|:--|:--|
|
6
|
+
|days|両端値を含む -999999999 から 999999999 の間|
|
7
|
+
|seconds|両端値を含む 0 から 86399 の間|
|
8
|
+
> |microseconds|両端値を含む 0 から 999999 の間|
|
9
|
+
|
10
|
+
Pythonは[type](https://docs.python.jp/3/library/functions.html#type)を使うとすぐに型がわかるので、それを足掛かりに色々調べてみてくださいね。
|
11
|
+
|
12
|
+
以下、修正前
|
13
|
+
---
|
1
14
|
```Python
|
2
15
|
>>> from datetime import datetime
|
3
16
|
>>> t = datetime.strptime('0:00:02.003647', '%H:%M:%S.%f')
|
1
追記
answer
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
```Python
|
2
|
+
>>> from datetime import datetime
|
3
|
+
>>> t = datetime.strptime('0:00:02.003647', '%H:%M:%S.%f')
|
2
4
|
>>> t
|
3
5
|
datetime.datetime(1900, 1, 1, 0, 0, 2, 3647)
|
4
6
|
>>> t.second
|