# Python 字符编解码

二进制只是二进制，取决于怎么编码和解码，unicode 转 utf8

```python
# -*- coding: UTF-8 -*-
if __name__ == '__main__':
    unicode_str = u'二进制只是二进制，取决于怎么编码和解码'
    print(unicode_str)

    utf8_str = unicode_str.encode('utf-8')
    print(utf8_str)

    # TODO(You)：请在此实现代码
    unicode_str_again = ...
    assert unicode_str_again == unicode_str
```

请选出下列能**正确**实现这一功能的选项。

## template

```python
if __name__ == '__main__':
    unicode_str = u'二进制只是二进制，取决于怎么编码和解码'
    print(unicode_str)

    utf8_str = unicode_str.encode('utf-8')
    print(utf8_str)

    unicode_str_again = utf8_str.decode('utf-8')
    print(unicode_str_again)
    assert unicode_str_again == unicode_str
```

## 答案

```python
unicode_str_again = utf8_str.decode('utf-8')
```

## 选项

### A

```python
unicode_str_again = utf8_str.decode()
```

### B

```python
unicode_str_again = utf8_str.decode('unicode')
```

### C

```python
unicode_str_again = utf8_str.encode('unicode')
```
