随笔分类 -  python模块自定义

摘要:def is_hex(word): word= word.lower() for i in range(len(word)): if not( word[i].startswith('0x') or word[i].isdigit() or word[i] in ['a','b','c','d',' 阅读全文
posted @ 2021-01-19 11:20 该显示昵称已被使用了 阅读(502) 评论(0) 推荐(0)
摘要:使用smb 下载文件 import smbclient # pip install smbprotocol import zlib import re import os smbclient.register_session("10.x.x.x", username="123", password= 阅读全文
posted @ 2021-01-12 13:13 该显示昵称已被使用了 阅读(545) 评论(0) 推荐(0)
摘要:基本 # 1. 【python字典】转json格式【str】 import json dic = {'a': 1, 'b': 2, 'c': 3} str1 = json.dumps(dic, sort_keys=True, indent=4, separators=(',', ':')) # 有换 阅读全文
posted @ 2020-12-25 11:28 该显示昵称已被使用了 阅读(2083) 评论(0) 推荐(0)
摘要:Django应用 #重写函数,返回json class JSONResponse(HttpResponse): """ An HttpResponse that renders its content into JSON. """ def __init__(self, data, **kwargs) 阅读全文
posted @ 2020-11-24 11:37 该显示昵称已被使用了 阅读(338) 评论(0) 推荐(0)
摘要:(数据库)CSV操作 # 从CSV中读取数据 df = pd.read_csv('pandas.csv',encoding = "utf-8",delimiter=",",error_bad_lines=False) # 读取本地CSV文件 df = pd.read_csv("C:/Users/fu 阅读全文
posted @ 2020-11-07 21:58 该显示昵称已被使用了 阅读(771) 评论(0) 推荐(0)
摘要:方法1. def get_all_news(self, response, file): rm_list = [ # r'</', # r'p>', # r'<', ] ret = response.xpath( '//p[not (img)][not (a)][position()>5] | // 阅读全文
posted @ 2020-10-28 07:02 该显示昵称已被使用了 阅读(360) 评论(0) 推荐(0)
摘要:import paramiko class My_ssh: def __init__(self,ip,username,password): self.ip=ip self.username=username self.password =password self.ssh_client = par 阅读全文
posted @ 2020-10-15 20:58 该显示昵称已被使用了 阅读(109) 评论(0) 推荐(0)
摘要:提醒用户使用了废弃的函数 def deprecated(func): """This decorator is used to mark functions as deprecated. It will result in a warning being emitted when the funct 阅读全文
posted @ 2020-10-04 16:50 该显示昵称已被使用了 阅读(788) 评论(0) 推荐(0)
摘要:import datetime import json import requests from exception import AsstException #自定义 from log import logger #自定义 class Messenger(object): def __init__ 阅读全文
posted @ 2020-10-04 12:17 该显示昵称已被使用了 阅读(726) 评论(0) 推荐(1)
摘要:随便用用1 import logging # logging.basicConfig(level=logging.ERROR, format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s:%(message)s') logging. 阅读全文
posted @ 2020-10-04 11:15 该显示昵称已被使用了 阅读(218) 评论(0) 推荐(0)
摘要:定义 # -*- coding: utf-8 -*- import os import configparser class Config(object): def __init__(self, config_file='config.ini'): self._path = os.path.join 阅读全文
posted @ 2020-10-04 11:10 该显示昵称已被使用了 阅读(742) 评论(0) 推荐(0)