执行方法
python encoder.py “txt.txt”
# -*- encoding: utf-8 -*-
# fileName: encoder.py
from sys import argv
import copy
import collections
"""
C 语言结构体 对应码流打印
typedef struct{
int name : 12;
int age : 8;
int height : 8;
int rsv: 4;
int income : 16;
int rsv2 : 16;
} typeStruct;
typeStruct = [
{"name" : 12},
{"age" : 8},
{"height": 8},
{"rsv": 4},
{"Income": 16},
{"rsv2":16}
]
"""
typeStruct = [
{
"name" : 12},
{
"age" : 8},
{
"height": 8},
{
"rsv": 4},
{
"Income": 16},
{
"rsv2":16}
]
script, input_file = argv
def getStructGrp(struct):
structGrp