文章分类 -  python

摘要:参考链接 zfill Python 字符串对象的 zfill() 方法返回指定长度的字符串 原字符串右对齐,位数不足则前面填充 0 当参数 width 小于字符串长度时返回原字符串 zfill() 语法 str.zfill(width) 参数 参数 说明 width 指定字符串的长度,原字符串右对齐 阅读全文
posted @ 2022-03-04 09:26 lifei888 阅读(242) 评论(0) 推荐(0)
摘要:参考链接 sequenceDiagram 秒数->>时间元组: localtime 时间元组->>字符串: asctime 字符串->>时间元组:strptime 时间元组->>秒数:mktime ~ > cat timediff.py 18s 11:06:34 # coding: utf-8 aa 阅读全文
posted @ 2022-02-28 14:48 lifei888 阅读(30) 评论(0) 推荐(0)
摘要:读文件 #!/usr/bin/env python #coding: utf-8 file=open('aa.txt'): for line in file: line=line.strip() print line 写文件 #!/usr/bin/env python #coding: utf-8 阅读全文
posted @ 2022-02-17 23:34 lifei888 阅读(24) 评论(0) 推荐(0)
摘要:ipremove #!/bin/env python import netaddr import copy def iprem(sumnet,subnet): result=copy.copy(sumnet) #print(sumnet) for net in sumnet: if net in s 阅读全文
posted @ 2022-02-12 17:14 lifei888 阅读(146) 评论(0) 推荐(0)
摘要:读取数据 # 导入模块 import pandas as pd # 定义读取函数 def readexcel(): datas=pd.read_excel('pandas_output.xlsx', sheet_name='Test01',engine='openpyxl') datas=datas 阅读全文
posted @ 2022-02-10 15:46 lifei888 阅读(21) 评论(0) 推荐(0)
摘要:参考文件 参考链接 解密 Python 中的对象模型 解密 Python 中的对象模型 正则表达式 解密正则表达式 netutils Netutils Functions time 函数 | 函数 |描述 | | | | |asctime([tuple])|将时间元组转换为字符串| |strptim 阅读全文
posted @ 2022-01-24 19:54 lifei888 阅读(40) 评论(0) 推荐(0)