python在線編譯 pythonencode什么意思?
pythonencode什么意思?python encode()方法按照encoding指定的編碼格式對(duì)字符串進(jìn)行編碼。errors參數(shù)可以指定不同的錯(cuò)誤處理方案。Syntax encode()方法語
pythonencode什么意思?
python encode()方法按照encoding指定的編碼格式對(duì)字符串進(jìn)行編碼。errors參數(shù)可以指定不同的錯(cuò)誤處理方案。Syntax encode()方法語法:str.encode編碼(encoding=“UTF-8”,errors=“strict”)參數(shù)編碼—要使用的編碼,例如“UTF-8”。錯(cuò)誤——設(shè)置不同的錯(cuò)誤處理方案。默認(rèn)值為“strict”,這意味著編碼錯(cuò)誤導(dǎo)致的Unicode錯(cuò)誤。其他可能的值有“ignore”、“replace”、“xmlchar replace”、“backslashreplace”和pass-throughcodecs.registererror()注冊(cè)的任何值。返回值此方法返回編碼的字符串。示例下面的示例顯示encode()方法的示例:#!/usr/bin/Python STR=“這是字符串示例。。。喔
!“打印”編碼字符串:“str.encode編碼(“base64”,“strict”)