python3 stock send() 函数报错: TypeError: a bytes-like object is required, not 'str'

python3 stock send() 函数报错: TypeError: a bytes-like object is required, not 'str'

原因:

python2 send() 函数接收的参数类型是 str,而 python3 send() 函数接收的数据类型是 bytes,所以在 python3 中需要将 send() 的入参使用 encode() 进行转化

python3 stock send() 函数报错: TypeError: a bytes-like object is required, not 'str'