2016-09-04 58 views

回答

11

Python的Base64

import base64 

encoded = base64.b64encode('Hello World!') 
print encoded 

# value of encoded is SGVsbG8gV29ybGQh 

JavaScript的btoa

var str = "Hello World!"; 
var enc = window.btoa(str); 

var res = enc; 

// value of res is SGVsbG8gV29ybGQh 

正如你可以看到他们都产生相同的结果。

相关问题