惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
博客园 - 【当耐特】
月光博客
月光博客
Vercel News
Vercel News
D
Docker
I
InfoQ
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 叶小钗
MongoDB | Blog
MongoDB | Blog
GbyAI
GbyAI
有赞技术团队
有赞技术团队
雷峰网
雷峰网
博客园 - 聂微东
小众软件
小众软件
Y
Y Combinator Blog
腾讯CDC
L
LangChain Blog
The GitHub Blog
The GitHub Blog
宝玉的分享
宝玉的分享
Stack Overflow Blog
Stack Overflow Blog
大猫的无限游戏
大猫的无限游戏
T
The Blog of Author Tim Ferriss

博客园 - DotNet1010

.NET 6 的 docker 镜像可以有多小 Code UTF-8 Console GB2312 Linux 中文乱码 穿透式监管与CTP swagger 兼容 docker 转发 配置 rust 条件编译 Debug Release rust-must-know-crates-5ad8 100DayOfRust python C# DES 加密转换 The Little Book of Rust Books .NET 5 WPF 配置文件变动 程序自动刷新 (reloadOnChange) C# 高精度定时器 NET number values such as positive and negative infinity cannot be written as valid JSON C# 各种序列化方案比较 MVVM WPF 简化 类的开发 websocket-per-message-compression Asp.net Core WebSocket 支持压缩 Redis 监控工具 期货行情查看客户端下载 完美解决windows10磁盘占用100%并出现卡顿、假死无反应 How to disable the unused macros warning? --rust 看阿里架构师是如何在高并发的情景下运筹帷幄
Python3 HDF5 中英文混合存储
DotNet1010 · 2020-09-10 · via 博客园 - DotNet1010
import numpy as np
import sys
import h5py as h5
import os
print("开始")
print("系统默认编码:{}".format(sys.stdout.encoding))

def test_002():
    dt_str = h5.special_dtype(vlen=str)
    student = np.dtype([('name',dt_str), ('age', 'i1'), ('marks', 'f4')]) 
    cn_test = np.array([('abc中国123', 21, 50),('xyz', 18, 75)], dtype = student)
    print(cn_test)
    file_name="deleteme.hdf5"
    if(os.path.isfile(file_name)):
        os.remove(file_name)
    my_hdf5=h5.File(file_name,mode="a")
    my_hdf5["gp03"]=cn_test
    my_hdf5.flush()
    my_hdf5.close()

    my_hdf5 = h5.File(file_name,'r')
    print("read cn data")
    print(my_hdf5['gp03'][:])
    my_hdf5.close()


test_002()