回答編集履歴
1
修正
answer
CHANGED
@@ -7,8 +7,15 @@
|
|
7
7
|
|
8
8
|
```python
|
9
9
|
x = b"blue"
|
10
|
-
print(x)
|
10
|
+
print(x, type(x)) # b'blue' <class 'bytes'>
|
11
11
|
|
12
12
|
y = x.decode("utf-8")
|
13
|
+
print(y, type(y)) # blue <class 'str'>
|
14
|
+
```
|
15
|
+
|
16
|
+
質問の例だと以下のようにすれば str 型になると思います。
|
17
|
+
|
13
|
-
|
18
|
+
```diff
|
19
|
+
- str(message.payload)
|
20
|
+
+ message.payload.decode("utf-8")
|
14
21
|
```
|