我需要将图像(或任何文件)转换为base64字符串.我使用不同的方式,但结果总是byte,而不是字符串.例:
import base64
file = open('test.png', 'rb')
file_content = file.read()
base64_one = base64.encodestring(file_content)
base64_two = base64.b64encode(file_content)
print(type(base64_one))
print(type(base64_two))
Run Code Online (Sandbox Code Playgroud)
回
<class 'bytes'>
<class 'bytes'>
Run Code Online (Sandbox Code Playgroud)
我如何获得字符串,而不是字节?Python 3.4.2.
如何在阵列中获得许多Sequelize结果?示例:我需要获取name表中的所有值字段test并在控制台中返回此字段.我写:
test.findAll().them(function(result) {
result.forEach(function(item) {
console.log(item.name);
});
});
Run Code Online (Sandbox Code Playgroud)
如何获取name数组中的所有值字段,没有forEach()?
(抱歉英文不好)
我应该如何构建 Node.js (Express) 应用程序?我这样做:
应该改变什么?怎么做更好?
(抱歉英语不好)