截取文本某一行的字符串

Read_Mac_str = ''
VBS_Mac_str = ''

with open('./Check_Mac.txt', 'r') as f:
    for num, line in enumerate(f):
        if num == 10:
            print(line)
            Read_Mac_str = line[40:79]
            print(Read_Mac_str)
            print()
            Read_Mac_str = line[47:49] + line[42:44] + line[77:79] + line[72:74] + line[67:69] + line[62:64]
            print("Read_MAC :" + Read_Mac_str)
            #break
f.close()
posted @ 2021-11-26 10:19  江南王小帅  阅读(61)  评论(0)    收藏  举报