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