2016-09-04 159 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 

正如你可以看到他們都產生相同的結果。

相關問題