搜索到与相关的文章
Python

萌新用Python尝试爬豆瓣top250

这是我在CSDN的第一篇博客,假期刚自学Python,尝试爬取了一下豆瓣top250.希望可以有大佬指点感谢importrequestsfrombs4importBeautifulSoupdefgethtml(url):try:kv={'user-agent':'Mozilla/5.0(WindowsNT10.0;Win64;x64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/59.0.3071.115Safari/

系统 2019-09-27 17:49:53 1924

Python

Python实现微信中找回好友、群聊用户撤回的消息功能示例

本文实例讲述了Python实现微信中找回好友、群聊用户撤回的消息功能。分享给大家供大家参考,具体如下:还在好奇好友撤回了什么消息吗?群里撤回了什么消息?下面的代码实现了:即使群、好友撤回了文本消息、表情、图片等消息,自己也能知道撤回的什么。#coding=utf-8importitchatfromitchat.contentimportTEXTfromitchat.contentimport*importsysimporttimeimportreimpor

系统 2019-09-27 17:49:48 1924

Python

猜数字游戏_Python

预先设置数字变量age_of_test=25#这里设置为25,也可随意guess_age=int(input("guessage:"))ifguess_age==age_of_test:print("Yes,yougotit!")#判断正确后打印Yes,yougotit!并继续执行命令elifguess_age>age_of_test:print("thinksmaller...")#判断数字小于预定值时提示!else:print("thinkbigger

系统 2019-09-27 17:49:37 1924

Python

python多进程间通信

这里使用pipe代码如下:importtimefrommultiprocessingimportProcessimportmultiprocessingclassD:@staticmethoddeftest(pipe):whileTrue:foriinrange(10):pipe.send(i)time.sleep(2)@staticmethoddeftest2(pipe):whileTrue:print('test2value:%s'%pipe.recv

系统 2019-09-27 17:49:29 1924

Python

Python thread demo

frommultiprocessingimportProcess,Queuefromtimeimporttimedeftask_handler(current_list,result_queue):total=0fornincurrent_list:total+=nresult_queue.put(total)defmain():processes=[]number_list=[xforxinrange(1,10000001)]result_queue=Q

系统 2019-09-27 17:48:29 1924

Python

python while 和 if的用法

#money=int(input('你有多少钱?'))#ifmoney>50:#print('打车回家')#b=input('到家了吗?')#ifb=='到家了':#print('我到家了阿')#else:#pass#please=input('你是男的还是女的?')#ifplease=='男的'orplease=='男':#print('你走吧')#elifplease=='美女':#age=int(input("今年多大拉?"))#ifint(age)

系统 2019-09-27 17:48:20 1924

Python

python excel转换csv代码实例

为了提高工作效率(偷懒),用python去解决。工作需要,需要将excel文件转化为csv文件,要是手工的一个个去转换,每个sheet页不但有几十个字段,中间还夹杂着空格,然后按顺序转换成csv文件,这要是手工完成,一两个还行,多了那就是要死人的节奏了,这时候想到了python,走起。__author__='zxl'importpandasaspdimportosimportxlrdpath=r'/Users/zhangxl/Desktop/'filena

系统 2019-09-27 17:47:56 1924

Python

Node.js与PHP、Python的字符处理性能对比

测试用例分为用函数和类来进行一个大字符串的字符逐一读取。测试代码Node.js函数varfs=require("fs");varcontent=fs.readFileSync("page.html",{encoding:"utf-8"});functionchars(content){varlength=content.length;varpos=0;while(pos++

系统 2019-09-27 17:47:51 1924

Python

Python Matplotlib库入门指南

Matplotlib简介Matplotlib是一个Python工具箱,用于科学计算的数据可视化。借助它,Python可以绘制如Matlab和Octave多种多样的数据图形。最初是模仿了Matlab图形命令,但是与Matlab是相互独立的.通过Matplotlib中简单的接口可以快速的绘制2D图表初试MatplotlibMatplotlib中的pyplot子库提供了和matlab类似的绘图API.复制代码代码如下:importmatplotlib.pyplo

系统 2019-09-27 17:47:25 1924

Python

python脚本实现查找webshell的方法

本文讲述了一个python查找webshell脚本的代码,除了查找webshell功能之外还具有白名单功能,以及发现恶意代码发送邮件报警等功能,感兴趣的朋友可以自己测试一下看看效果。具体的功能代码如下:#!/usr/bin/envpython#-*-coding:utf-8-*-importosimportsysimportreimportsmtplib#设定邮件fromaddr="smtp.qq.com"toaddrs=["voilet@qq.com"]

系统 2019-09-27 17:47:03 1924