#!/usr/bin/env python
# -*- coding: utf-8 -*-
import base64
if __name__ == '__main__':
# 对字符串编码
originStr = "14|130|T-000130-01|JinrongJSG"
base64_1 = base64.b64encode(originStr)
base64_2 = base64.encodestring(originStr)
print('base64_1: %s' % base64_1)
print('base64_2: %s' % base64_2)
# 对字符串解码
serStr = "MTR8MTMwfFQtMDAwMTMwLTAxfEppbnJvbmdKU0c="
base64_de_1 = base64.b64decode(serStr)
base64_de_2 = base64.decodestring(serStr)
print('base64_de_1: %s' % base64_de_1)
print('base64_de_2: %s' % base64_de_2)