zoukankan      html  css  js  c++  java
  • 防火墙站名资源脚本

    import os
    import pandas

    excel_name = input("请将本软件和excel表格放在同一目录下,并输入excel表格的名字,不包括xlsx后缀:")+'.xlsx'
    print('使用的excel文件名为:', excel_name)
    excel_path = os.path.join(os.getcwd(), excel_name)


    def excel_to_txt(path):
    df = pandas.read_excel(path, sheet_name=0, header=0)
    txt_path_a = os.path.join(os.getcwd(), 'A网.txt')
    print(txt_path_a)
    txt_path_b = os.path.join(os.getcwd(), 'B网.txt')
    txt_path_station = os.path.join(os.getcwd(), '站名.txt')
    with open(txt_path_a, 'w') as f:
    for i in range(len(df)):
    name = df['name'][i]
    ip_a = df['ip_a'][i]
    mask_a = df['mask_a'][i]
    code = 'edit "%s" set subnet %s %s next ' % (name, ip_a, mask_a)
    f.write(code)
    print('A网.txt完成')
    with open(txt_path_b, 'w') as f:
    for i in range(len(df)):
    name = df['name'][i]
    ip_b = df['ip_b'][i]
    mask_b = df['mask_b'][i]
    code = 'edit "%s" set subnet %s %s next ' % (name, ip_b, mask_b)
    f.write(code)
    print('B网.txt完成')
    with open(txt_path_station, 'w') as f:
    for i in range(len(df)):
    name = df['name'][i]
    code = '%s ' % name
    f.write(code)
    print('站名.txt完成')


    if __name__ == '__main__':
    excel_to_txt(excel_path)
  • 相关阅读:
    集合框架之Map学习
    集合框架之Set学习
    解决word2016鼠标每点击一下就出现一个保存的圆圈
    装饰者模式
    IO的学习与使用
    Enumeration的学习
    在html页面中引入公共的头部和底部
    WEB-INF下资源访问问题
    给自己立一个flag
    elementui 日期选择值格式
  • 原文地址:https://www.cnblogs.com/sundahua/p/13586628.html
Copyright © 2011-2022 走看看