小知识积累
NumPy
在输出中字符串前出现了b的意义
代码
# -*- coding: utf-8 -*-
import numpy as np
# 自python更新到3.0后,dtype类型中'S', 'a' 被修改为 (byte-)string类型,所以你的输出含b指的是此字符串类型为byteString类型
student = np.dtype([('name', 'S20'), ('age', 'i1'), ('marks', 'f4')])
a = np.array([("ac", '15', '60.0'), ("dg", '21', '100.1')], dtype=student)
print(a)
输出
意义
自python更新到3.0后,dtype类型中’S’, ‘a’ 被修改为 (byte-)string类型,所以这里输出的字符串前含b指的是此字符串类型为byteString类型