python

def record_line(cmd,count):
    return "-record(qx" + cmd +"msgbodylayer" +str(count)+","+'\n'
def left():
    return "    {\n"
def right():
    return "    }).\n"
    
cmd = input("输入命令码:")
count = input("输入层数:")
Rec = record_line(str(cmd),int(count))


def layer0():
    return "cmdCode,\n"+"mcuCount,\n" +" msgBody\n"
def layer1():
    return "mcuAddr,\n"+"checkPoints,\n"+"layer2Msg\n"
def layer2():
    return "portAddr,\n"+"derection,\n"+"enbale,\n"




def main():
    file_name = "qx"+str(cmd)+".hrl"
    f = open(file_name,"w")
    Out = Rec + left()+layer2()+right()
    f.write(Out)
    f.close()
    
if __name__ == '__main__':
    main()

你可能感兴趣的:(硬件)