问题描述
我正在尝试将文本从Excel工作表转换为txt文件。我有一个包含这些数据的Excel文件
101 | BL101 | eth1/1 | BL101-eth1/1
102 | BL102 | eth1/2 | BL102-eth1/2
103 | BL103 | eth1/3 | BL103-eth1/3
interface port-channel 101
description BL101
interface Ethernet1/1
description BL101-eth1/1
interface port-channel 102
description BL102
interface Ethernet1/2
description BL102-eth1/2
等...
这是我的代码:
for row_idx in range(0,num_rows):
for col_idx in range (0,num_cols):
cell_obj = sheet.cell (row_idx,col_idx)
print ('%s' % (cell_obj.value))
print('--- END ---')
我得到这些结果
101
BL101
interface Ethernet1/1
BL101-eth1/1
--- END ---
102
BL102
interface Ethernet1/2
BL102-eth1/2
--- END ---
等...
但是我不能在行之间加上一些单词(界面,描述)。谁能帮我吗?
谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)