样例输入
3
样例输出
20180861101,张亚佳,19,96.5 20180861102,韩云飞,20,94.5 20180861103,祖丞,21,92.5
解题代码
#coding=gbk """【""" import struct n=int(input()) f=open("stu.dat","rb") for i in range(n): stu_bytes=f.read(struct.calcsize('=11s10sid')) stu_tuple=struct.unpack('=11s10sid',stu_bytes) xh=str(stu_tuple[0],'GBK') xm=str(stu_tuple[1],'GBK').replace('\x00','') age,cj=stu_tuple[2],stu_tuple[3] print(xh,xm,age,cj,sep=",") f.close() """】"""
标签:字节,tuple,GBK,信息,保存,stu From: https://www.cnblogs.com/hghdbk/p/16838239.html