代码示例:(标识:python_ref_string_encode_1)
python_ref_string_encode_1.py
txt = "My name is Ståle"

x = txt.encode()

print(x)
运行结果: