config = “Config”
print( config.encode() )
config_list = list(config.encode())
print(config_list)
str1=”儲蓄保險王”
print(str1.encode()) #預設值為utf-8
print(str1.encode(“utf-8”))
str1Lst = list(str1.encode())
print(str1Lst)

[67,111,110,102,105,103]
其實只是C o n f i g的ASCII碼(ord函數)
用以下語法也可以萃取出一樣的list:


與matlab結果一致:
rx_ctrl: b’\x00C\x00o\x00n\x00f\x00i\x00g’
Control:
b’\x00C\x00o\x00n\x00t\x00r\x00o\x00l’
ReControl:

b’\x00R\x00e\x00C\x00o\x00n\x00t\x00r\x00o\x00l’


![Python常用的模組內建常數; __name__ ; __file__ ; __doc__ ; __all__ ;__dict__; vars()->Dict[str,str] ; dir()->List[str] Python常用的模組內建常數; __name__ ; __file__ ; __doc__ ; __all__ ;__dict__; vars()->Dict[str,str] ; dir()->List[str]](https://i0.wp.com/savingking.com.tw/wp-content/uploads/2022/11/20221112184006_50.png?quality=90&zoom=2&ssl=1&resize=350%2C233)








近期留言