-
python:部分内置函数与匿名函数
所属栏目:[Python] 日期:2020-07-29 热度:200
一、内置函数1,数据类型:int,bool ..........2,数据结构:dict,list,tuple,set,str3,reversed--保留原列表,返回一个反序的迭代器reversed()l =[1,2,3,4,5]l2 =reversed(l)print(l2)4,slice切片l =(1,2,23,213,5612,234,43)sli =slice(1,5,2)print(l[sl[详细]
-
关于python2.7的md5加密遇到的问题(TypeError: Unicode-objects must be en
所属栏目:[Python] 日期:2020-07-29 热度:82
https://blog.csdn.net/u012087740/article/details/48439559import hashlibimport sysdef md5s():m=hashlib.md5()strs=sys.argv[1]m.update(strs.encode(utf8))print(m.hexdigest())if __name__==__main__:md5s()注意update()必须指定要加密的字符串的字符编[详细]
-
安装带 Python 支持的 uWSGI
所属栏目:[Python] 日期:2020-07-29 热度:95
http://uwsgi-docs-cn.readthedocs.io/zh_CN/latest/WSGIquickstart.html这个快速入门指南将会向你展示如何部署简单的 WSGI 应用和普通 web 框架。Python 在这里特指 CPython,如果你想用 PyPy 你需要使用专门的插件:The PyPy plugin, Jython 的支持正在开发[详细]
-
No module named Crypto--转
所属栏目:[Python] 日期:2020-07-29 热度:75
https://blog.csdn.net/lacoucou/article/details/53152122背景:win10+python 2.7在python 中使用AES算法时,会报告上述错误,原因是Crypto并非标准模块,需要自己单独安装。安装方法:1.pip install pycropt 这中办法经常会报错:error: Microsoft Visual C+[详细]
-
python识别图片文字
所属栏目:[Python] 日期:2020-07-29 热度:146
因为学校要求要刷一门叫《包装世界》的网课,而课程里有200多道选择题,而且只能在手机完成,网页版无法做题,而看视频是不可能看视频的,这辈子都不可能看...所以写了几行代码来进行百度搜答案。思路如下:手机屏幕投影到电脑上;截图并识别图片文字;调用百[详细]
-
1.1 官网地址
所属栏目:[Python] 日期:2020-07-29 热度:134
原文地址:http://www.jianshu.com/p/c3fc3129407d1. 爬虫框架webmagicWebMagic是一个简单灵活的爬虫框架。基于WebMagic,你可以快速开发出一个高效、易维护的爬虫。1.1 官网地址官网文档写的比较清楚,建议大家直接阅读官方文档,也可以阅读下面的内容。地址[详细]
-
python2 与 python3 语法区别--转
所属栏目:[Python] 日期:2020-07-29 热度:192
原文地址:http://old.sebug.net/paper/books/dive-into-python3/porting-code-to-python-3-with-2to3.html使用2to3将代码移植到Python 3Life is pleasant. Death is peaceful. It’s the transition that’s troublesome.— Isaac Asimov (attributed)概述几[详细]
-
Python学习网络爬虫--转
所属栏目:[Python] 日期:2020-07-29 热度:124
原文地址:https://github.com/lining0806/PythonSpiderNotesPython学习网络爬虫主要分3个大的版块:抓取,分析,存储另外,比较常用的爬虫框架Scrapy,这里最后也详细介绍一下。首先列举一下本人总结的相关文章,这些覆盖了入门网络爬虫需要的基本概念和技巧[详细]
-
java.net.URISyntaxException: Illegal character in query
所属栏目:[Python] 日期:2020-07-29 热度:111
java使用httpclient爬取一个网站的时候,请求:String url3=http://sh.58.com/ershoufang/33562546149042x.shtml?amp;params=esfjxpclranxuanctrAB^descamp;fzbref=0amp;entinfo=33562546149042_0amp;cookie=|||c5/nn1jLReK730pAPL8MAg==amp;psid=10821968819[详细]
-
selenium打开chrome浏览器代码
所属栏目:[Python] 日期:2020-07-29 热度:109
import osfrom selenium import webdriverchromedriver = C:Program Files (x86)GoogleChromeApplicationchrome.exeos.environ[webdriver.chrome.driver] = chromedriverdriver = webdriver.Chrome(chromedriver)driver.quit()[详细]
-
python2 str object has no attribute decode
所属栏目:[Python] 日期:2020-07-29 热度:73
0102030405060708.decode(hex)上述代码,报错:str object has no attribute decode查找原因:https://stackoverflow.com/questions/29030725/str-object-has-no-attribute-decodeYou cannot decode string objects; they arealreadydecoded. Youll have to u[详细]
-
Java. How to use headless browsers for crawling web and scra
所属栏目:[Python] 日期:2020-07-29 热度:189
https://www.linkedin.com/pulse/java-how-use-headless-browsers-crawling-web-scraping-data-taluyev/Did you ever think to implement software to scrape data from web pages? I guess everyone could think about crawling web.The simplest way to get[详细]
-
爬虫推荐的工具
所属栏目:[Python] 日期:2020-07-29 热度:95
爬虫推荐的工具:pyspider,BeautifulSouprequestsscrapymongodbrediskafka.repyV8:python执行js的插件phatomjs:一个无界面的,可脚本编程的WebKit浏览器引擎。它原生支持多种web 标准:DOM 操作,CSS选择器,JSON,Canvas 以及SVGselenium:是一个用于Web应[详细]
-
java代码实现python2中aes加密经历
所属栏目:[Python] 日期:2020-07-29 热度:157
背景: 因项目需要,需要将一个python2编写的aes加密方式改为java实现。1.源python2实现from Crypto.Cipher import AESfrom binascii import b2a_hex, a2b_heximport hashlibimport urllibclass aesCrypt():def __init__(self, undealKey):key = turnMd5(unde[详细]
-
1. Grabs All Hyperlinks
所属栏目:[Python] 日期:2020-07-29 热度:128
原文地址:http://www.mkyong.com/java/jsoup-html-parser-hello-world-examples/Jsoup, a HTML parser, its “jquery-like” and “regex” selector syntax is very easy to use and flexible enough to get whatever you want. Below are three examples t[详细]
-
Windows键盘驱动结构与消息机制--转
所属栏目:[Python] 日期:2020-07-29 热度:69
https://www.douban.com/note/318793892/本文主要介绍按键消息是如何传递到窗口并转化为具体的按键消息的。Windows系统是事件驱动的多任务系统,其中按键和鼠标是主要的事件。按键是由键盘驱动获得并转换,然后广播给各个窗口。整个架构的核心是csrss.exe这个[详细]
-
pyDes 实现 Python 版的 DES 对称加密/解密--转
所属栏目:[Python] 日期:2020-07-29 热度:79
https://my.oschina.net/leejun2005/blog/586451手头有个 Java 版的 DES 加密/解密程序,最近想着将其 Python 重构下,方便后续脚本解析,捣鼓了两下 pyDes 貌似很方便,不过据网上其他同学测试说PyCrypto 性能要比 pyDes 高一个数量级,这里我没有做具体性能[详细]
-
python:生成器进阶
所属栏目:[Python] 日期:2020-07-29 热度:130
1,列表推导式值 for 循环2,生成器表达式g=(i fori inrange(10))print(g)for i in g: print(i)3,列表推导式与生成器表达式的区别#括号不一样#返回值不一样 ===》生成器表达式几乎不占内存g =(鸡蛋%s%i for i in range(10))print(g)for i in g:print(i)4,各[详细]
-
python:迭代器与生成器
所属栏目:[Python] 日期:2020-07-29 热度:103
一、导入1,dir功能print(dir([]))告诉我这个列表拥有的所有方法带着双下划线的方法叫做双下方法。2,一个列表执行了_iter_()之后的返回值就是一个迭代器3,_length_hint_元素个数4,_setstate_从指定位置取值5,[]._iter_()迭代器----_next_通过next就可以从[详细]
-
老男孩教育Python自动化2.0课程课件目录
所属栏目:[Python] 日期:2020-07-21 热度:65
Day1 - Python基础1 介绍、基本语法、流程控制 Day2 - Python基础2列表、字典、集合 Day3 - Python基础3 函数、递归、内置函数 Day4 - Pyth[详细]
-
Python之路,Day21 - 常用算法学习
所属栏目:[Python] 日期:2020-07-21 热度:54
本节内容 1.算法定义 算法(Algorithm)是指解题方案的准确而完整的描述,是一系列解决问题的清晰指令,算法代表着用系统的方法描述解决问题的策略机制。也就是说,能够对一定规范的输入,在有限时间内[详细]
-
python 之路,Django rest framework 初探
所属栏目:[Python] 日期:2020-07-21 热度:176
Django rest framework介绍 Django REST framework is a powerful and flexible toolkit for building Web AP[详细]
-
python 字典(dict)按键和值排序
所属栏目:[Python] 日期:2020-07-21 热度:137
python 字典(dict)的特点就是无序的,按照键(key)来提取相应值(value),如果我们需要字典按值排序的话,那可以用下面的方法来进行:1 下面的是按照value的值从大到小的顺序来排序。dic = {a:31, bc:5, c:3, asd:4, aa:74, d:0}dict= sorted(dic.items()[详细]
-
python统计日志小脚本
所属栏目:[Python] 日期:2020-07-21 热度:72
日志格式如下:[ 2016-06-28T00:10:33-03:00 ] xxx.xx.xx.xxx /api/index/xxx/ERR: code:400message:params:country:ustoken:uq6euz9dou6aqtk1Python(3)脚本如下:import urllib.requestimport ntpathimport os, sysimport timedef dirList(path):filelist[详细]
-
python学习笔记十七:base64及md5编码
所属栏目:[Python] 日期:2020-07-21 热度:115
一、Python Base64编码Python中进行Base64编码和解码要用base64模块,代码示例:#-*- coding: utf-8 -*-import base64str = cnblogsstr64 = base64.b64encode(str)print str64 #Y25ibG9ncw==print base64.b64decode(str64) #cnblogs二、MD5#Python 2.ximport[详细]