随笔分类 -  Python

Writing and Writing
摘要:#!/usr/bin/python3# -*-coding:utf-8 -*-# @Time : 2019/9/27 17:04# @Author : v_ctaozhangimport functools# 不带参数的装饰器def log(func): @functools.wraps(func) 阅读全文
posted @ 2019-09-27 17:45 JustLittle 阅读(195) 评论(0) 推荐(0) 编辑
摘要:前言 处理配置文件做增、删、改、查 操作。 配置文件的格式如下:“[ ]”包含的为 section,section 下面为类似于 key - value 的配置内容; configparser 默认支持 ‘=’ ‘:’ 两种分隔。 configparser 常用方法 1.使用 configparse 阅读全文
posted @ 2018-05-28 18:17 JustLittle 阅读(348) 评论(0) 推荐(0) 编辑
摘要:网址:持续更新中 Python: Python第三方离线库下载 Python文件处理 Python面向对象 Python装饰器 Python错误和异常 Python必学模块 Python进阶 Python正则表达式 Python走进Requests库 Python3使用编程技巧进阶 操作系统命令: 阅读全文
posted @ 2018-05-25 15:32 JustLittle 阅读(508) 评论(0) 推荐(1) 编辑
摘要:https://blog.csdn.net/jmilk/article/details/50047457 阅读全文
posted @ 2018-04-12 17:41 JustLittle 阅读(235) 评论(0) 推荐(0) 编辑
摘要:1 import sys 2 import multiprocessing 3 import re 4 import os 5 import urllib.request as lib 6 7 def craw_links( url,depth,keyword,processed): 8 ''' url:the url to craw 9 deth:t... 阅读全文
posted @ 2017-06-29 22:04 JustLittle 阅读(341) 评论(0) 推荐(0) 编辑
摘要:ftpServer.py ftpClient.py 阅读全文
posted @ 2017-06-29 00:05 JustLittle 阅读(268) 评论(0) 推荐(0) 编辑
摘要:sockMiddle_server.py sockMiddle.py sockMiddle_client.py 阅读全文
posted @ 2017-06-27 22:32 JustLittle 阅读(2219) 评论(0) 推荐(0) 编辑
摘要:1 ''' 2 为了防止黑客攻击或者负载均衡,会经常变换主机,这样同一个域名在不同时间可能会对应不同的IP地址,在这种情况下可以通过 3 socket模块的gethostbyname()函数来实时获取目标主机的IP地址 4 ''' 5 from time import sleep 6 from socket import gethostbyname 7 from datetime ... 阅读全文
posted @ 2017-06-27 21:01 JustLittle 阅读(344) 评论(0) 推荐(0) 编辑
摘要:1 #绝大多数成功的网络攻击都是以端口扫描开始的,在网络安全和黑客领域,端口扫描是经常用到的技术,可以探测指定主机上是否 2 #开放了指定端口,进一步判断主机是否运行了某些重要的网络服务,最终判断是否存在潜在的安全漏洞,从一定意义上将也属于系统运维的范畴 3 4 #端口扫描器程序:模拟端口扫描器的工作原理,并采用多进程技术提高扫描速度 5 import socket 6 impor... 阅读全文
posted @ 2017-06-27 20:58 JustLittle 阅读(2542) 评论(0) 推荐(0) 编辑
摘要:import socket import threading import time activeDegree=dict() flag=1 def main(): global activeDegree global glag #获取本机IP地址 HOST=socket.gethostbyname(socket.gethostbyname()) #创建原... 阅读全文
posted @ 2017-06-25 15:31 JustLittle 阅读(4378) 评论(0) 推荐(0) 编辑
摘要:zServer.py zClient.py 先运行zServer.py再运行zClinet.py 阅读全文
posted @ 2017-06-23 22:49 JustLittle 阅读(312) 评论(0) 推荐(0) 编辑
摘要:zReceiver.py zSender.py 注明:先将zSender.py中的ip地址替换为要接收的ip地址,先在终端(mac)\命令行启动接收端,在其输入: cd xx 切换到zReceiver.py文件所在目录,xx为路径 python zReceiver.py 执行接收端 再新建一个终端\ 阅读全文
posted @ 2017-06-23 14:13 JustLittle 阅读(269) 评论(0) 推荐(0) 编辑
摘要:1 ''' 2 MogoDB数据库可以到官方网站https://www.mongodb.org/downloads下载,安装之后打开命令提示符环境并切换到MongoDB安装目录总的 3 server\3.2\bin文件夹,然后执行mongod --dbpath D:\data --journal --storageEngine = mmapvl 启动MongonDB,当然需要首先在... 阅读全文
posted @ 2017-06-21 17:08 JustLittle 阅读(180) 评论(0) 推荐(0) 编辑
摘要:#调用自定义函数 #占位符的使用 #迭代器生成数据 #迭代器生成更简洁的方式 阅读全文
posted @ 2017-06-21 15:40 JustLittle 阅读(653) 评论(0) 推荐(0) 编辑
摘要:1 import os 2 import stat 3 4 def remove_readonly(func,path): #定义回调函数 5 os.chmod(path,stat.S_IWRITE) #删除文件的只读文件 6 func(path) #在次调用刚刚失败的函数 7 8 def del_dir(path,onerror=None)... 阅读全文
posted @ 2017-06-20 13:50 JustLittle 阅读(949) 评论(0) 推荐(0) 编辑
摘要:1 from zipfile import ZipFile 2 from os import listdir 3 from os.path import isfile,isdir,join 4 5 def addFileIntoZipfile(srcDir,fp): 6 for subpath in listdir(srcDir): 7 subpath=j... 阅读全文
posted @ 2017-06-20 08:57 JustLittle 阅读(2998) 评论(0) 推荐(0) 编辑
摘要:1 #docx文档题库包含很多段,每段一个题目,格式为:问题。(答案) 2 #数据库datase.db中tiku表包含kechengmingcheng、zhanngji、timu、daan四个字段 3 import sqlite3 4 from docx import Document 5 6 doc = Document('《Python程序设计》题库.docx') 7 8... 阅读全文
posted @ 2017-06-20 08:14 JustLittle 阅读(739) 评论(0) 推荐(0) 编辑
摘要:使用pip安装Python扩展库memory_profiler 1 from memory_profiler import profile 2 3 @profile #修饰器 4 def isPrime(n): 5 if n == 2: 6 return True 7 for i in range(2,int(n**0.5)+2): 8 ... 阅读全文
posted @ 2017-06-19 17:36 JustLittle 阅读(351) 评论(0) 推荐(0) 编辑
摘要:Stack.py 单元测试:pTest.py 阅读全文
posted @ 2017-06-19 17:22 JustLittle 阅读(252) 评论(0) 推荐(0) 编辑
摘要:1 while True: 2 x =input('Pleaes input:') 3 try: 4 x=int(x) 5 print('You have input {0}'.format(x)) 6 break 7 except Exception as e: 8 prin... 阅读全文
posted @ 2017-06-19 16:42 JustLittle 阅读(705) 评论(0) 推荐(0) 编辑