python 和ASP之间通过url接口进行数据传递:

  1. 使用python编写后台服务,使用Asp编写后台服务,两个服务之间进行数据传递时,使用base64进行转换,这样,两个系统之间可以正常的转换。
  2. eg:在asp中
  3. FileStream stream = new FileStream(longTermModel.DataFile, FileMode.Open);
  4.  byte[] bytes = new byte[(int)stream.Length];
  5.  stream.Read(bytes, 0, bytes.Length);
  6. stream.Close();
  7. string txt = Convert.ToBase64String(bytes);
  8. 在python中:将获取的数据从base64转换为bytes:
    data =base64.urlsafe_b64decode(txt)
  9. 其中省略了url解析的过程,只记录了数据转换的过程,这样,数据可以正常传递和解析。

猜你喜欢

转载自blog.csdn.net/u010565765/article/details/80893513