回答編集履歴
1
追加質問に回答
answer
CHANGED
@@ -10,4 +10,25 @@
|
|
10
10
|
>>> data = struct.unpack('f'*(len(count)//4),count)
|
11
11
|
>>> print('{:<10.5}'.format(data[0]))
|
12
12
|
2.3694e-38
|
13
|
+
```
|
14
|
+
|
15
|
+
-----------------
|
16
|
+
|
17
|
+
追記
|
18
|
+
|
19
|
+
複数要素に対しては以下の様にプリントします。
|
20
|
+
|
21
|
+
```python
|
22
|
+
>>> count = b'\1\1\1\1\2\2\2\2\3\3\3\3'
|
23
|
+
>>> data = struct.unpack('f'*(len(count)//4),count)
|
24
|
+
>>> for d in data:
|
25
|
+
... print('{:<10.5}'.format(d))
|
26
|
+
...
|
27
|
+
2.3694e-38
|
28
|
+
9.5515e-38
|
29
|
+
3.8501e-37
|
30
|
+
>>> for d in data:
|
31
|
+
... print('{:<10.5}'.format(d), end=', ')
|
32
|
+
...
|
33
|
+
2.3694e-38, 9.5515e-38, 3.8501e-37,
|
13
34
|
```
|