Python教程 encode()方法的使用

2024-11-20 18:09:57

1、新建一个encode()方法的使用.py,如图所示:

Python教程 encode()方法的使用

3、encode() 方法的作用:指定字符串的编码,如图所示:

Python教程 encode()方法的使用

5、将 str1 的编码设置为utf-8,代码:st1r_utf8 = str1.encode("UTF-8");

Python教程 encode()方法的使用

7、至此,本教程结束!

猜你喜欢