比如:创建一个文件bit0.txt
里面的文件内容是:
Port Command ExpectedResult Comments
A C Ack Resp:\x43\x80 ; All flags bit of port A clear
B C Ack Resp:\x43\x80 ; All flags bit of port B clear
A S001002 Ack Resp:\x06\x53 ; S command Change output 1
A C Ack Resp:\x43\x81 ; port A bit 0 set
B C Ack Resp:\x43\x81 ; port B bit 0 set
A Q Ack Resp:\x51\x31 ; read change queue on port A
A C Ack Resp:\x43\x80 ; port A bit 0 clear
B C Ack Resp:\x43\x81 ; port B bit 0 set
B Q Ack Resp:\x51\x31 ; read change queue on port B
A C Ack Resp:\x43\x80 ; port A bit 0 clear
B C Ack Resp:\x43\x80 ; port B bit 0 clear
现在我必须通过另一个 python 程序读取这个文件,输出应该是这样的:
读取文件后,API 应返回:
result = [['A','C', 'Ack Resp:\x43\x80'],
['B','C', 'Ack Resp:\x43\x80'],
['A','S001002', 'Ack Resp:\x06\x53'],
...............till end of file ]