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

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

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

7、至此,本教程结束!
1、新建一个encode()方法的使用.py,如图所示:
3、encode() 方法的作用:指定字符串的编码,如图所示:
5、将 str1 的编码设置为utf-8,代码:st1r_utf8 = str1.encode("UTF-8");
7、至此,本教程结束!