随笔分类 - IO操作
摘要:package com.test.util; import com.csvreader.CsvReader; import jdk.nashorn.internal.runtime.regexp.joni.exception.ValueException; import java.util.Rand
阅读全文
摘要:原理: file.seek(offset, whence) offset 偏移量,也就是相对于whence 的向前向后读取字节个数的值,可以负数,负数向前,整数向后,默认0 whence 有两种表示方法:纯数字,python内置函数 0,1,2 分别对应os.SEEK_SET,os.SEEK_CUR
阅读全文
摘要:df -h 查看磁盘使用有一个vdb满了 df -i 查看inode 使用率 显示文件大小: du -sh /* du参数: -a : 列出所有的文件与目录容量,因为默认仅统计目录下面的文件量而已; -h : 以人们较易读的容量格式(G/M)显示; -s : 列出总量,而不列出每个个别的目录占用了容
阅读全文
摘要:import yaml import json import csv import configparser class IoUtils(object): """ dependency: pip install pyyaml yaml_r: read yaml ,return dict yaml_w
阅读全文
摘要:def read_json(path): """return dict""" with open(path,'r+')as f: return json.load(f) def write_json(path,data): with open(path,"w+")as f: json.dump(da
阅读全文
摘要:import csv def read_csvList(path="./datasets/test.csv")->list: """return data format [[],[]]""" with open(file=path,mode="r")as f: df=csv.reader(f,dia
阅读全文
摘要:import pandas as pd"""pandas doc:df.dtypes 查看数据每column 数据类型 id int64x0 float64df.reindex 查看多少行多少列的数据结构 [569 rows x 21 columns]>df.reindex_axis 查看数据行列带
阅读全文