Skip to content
  • 关于我

charlie笔记

A programmer’s note boke for work and life

python实现猜数字游戏(无重复数字)示例分享

12 9月10 11月 by helenadmin

代码如下: import time, random class guessnum: def __init__( […]

Continue reading
Posted in Python

python爬虫框架scrapy安装使用步骤

12 9月10 11月 by helenadmin

一、爬虫框架scarpy简介scrapy 是一个快速的高层次的屏幕抓取和网页爬虫框架,爬取网站,从网站页面得到 […]

Continue reading
Posted in Python

python读取html中指定元素生成excle文件示例

12 9月10 11月 by helenadmin

python2.7编写的读取html中指定元素,并生成excle文件 代码如下: #coding=gbkimp […]

Continue reading
Posted in Python

使用python实现扫描端口示例

12 9月10 11月 by helenadmin

python最简洁易懂的扫描端口代码.运行绝对会很有惊奇感 代码如下: from threading impo […]

Continue reading
Posted in Python

使用python绘制人人网好友关系图示例

12 9月10 11月 by helenadmin

代码依赖:networkx matplotlib 代码如下: #! /bin/env python# -*- […]

Continue reading
Posted in Python

python实现zencart产品数据导入到magento(python导入数据)

12 9月10 11月 by helenadmin

python版本要求在3.3.x,需要mysql connector for python第三方库支持不适用所 […]

Continue reading
Posted in Python

python异步任务队列示例

12 9月10 11月 by helenadmin

很多场景为了不阻塞,都需要异步回调机制。这是一个简单的例子,大家参考使用吧 代码如下: #!/usr/bin/ […]

Continue reading
Posted in Python

用python编程实现语音控制电脑

12 9月10 11月 by helenadmin

电脑面前的你,是否也希望能让电脑听命于你? 当你累的时候,只需说一声“我累了”,电脑就会放着优雅的轻音乐来让你 […]

Continue reading
Posted in Python

python实现目录树生成示例

12 9月10 11月 by helenadmin

代码如下: #!/usr/bin/env python# -*- coding: utf-8 -*-impor […]

Continue reading
Posted in Python

python局域网ip扫描示例分享

12 9月10 11月 by helenadmin

代码如下: #!/usr/bin/python# -*- coding: utf-8 -*- from sca […]

Continue reading
Posted in Python

python读写ini文件示例(python读写文件)

12 9月10 11月 by helenadmin

很类似java的properties文件xml文件 代码如下: db_config.ini[baseconf] […]

Continue reading
Posted in Python

python实现ip查询示例

12 9月10 11月 by helenadmin

以下代码实现了ip查询功能处理程序 代码如下: import os,time def getip(filepa […]

Continue reading
Posted in Python

python判断windows隐藏文件的方法

12 9月10 11月 by helenadmin

1. 通过windows attrib 命令获取文件隐藏属性 代码如下: syntax attrib [ + […]

Continue reading
Posted in Python

python解析中国天气网的天气数据

12 9月10 11月 by helenadmin

使用方法:terminal中输入 代码如下: python weather.py http://www.wea […]

Continue reading
Posted in Python

python实现文件名批量替换和内容替换

12 9月10 11月 by helenadmin

指定文件夹,指定文件类型,替换该文件夹下全部文件的内容。 注意在window下的读写内容需要指定编码,还需要在 […]

Continue reading
Posted in Python

python读写redis数据库操作示例

12 9月10 11月 by helenadmin

使用python如何操作redis呢?下面用实例来说明用python读写redis数据库。比如,我们插入一条数 […]

Continue reading
Posted in Python

python实现k均值算法示例(k均值聚类算法)

12 9月10 11月 by helenadmin

简单实现平面的点k均值分析,使用欧几里得距离,并用pylab展示。 代码如下: import pylab as […]

Continue reading
Posted in Python

python基础教程之元组操作使用详解

12 9月10 11月 by helenadmin

简介 tuple 1.元组是以圆括号“()”包围的数据集合,不同成员以“,”分隔。通过下标进行访问 2.不可变 […]

Continue reading
Posted in Python

python实现保存网页到本地示例

12 9月10 11月 by helenadmin

学习python示例:实现保存网页到本地 代码如下: #coding=utf-8__auther__ = &# […]

Continue reading
Posted in Python

python基础教程之简单入门说明(变量和控制语言使用方法)

12 9月10 11月 by helenadmin

简介有兴趣可以看看: 解释性语言+动态类型语言+强类型语言交互模式:(主要拿来试验,可以试试 ipython) […]

Continue reading
Posted in Python

python使用循环实现批量创建文件夹示例

12 9月10 11月 by helenadmin

代码很简单,其中用到了python的sys模块,大家参考使用吧 代码如下: import os,sysbase […]

Continue reading
Posted in Python

python使用代理抓取网站图片(多线程)

12 9月10 11月 by helenadmin

一、功能说明:1. 多线程方式抓取代理服务器,并多线程验证代理服务器ps 代理服务器是从http://www. […]

Continue reading
Posted in Python

pythonbreak语句详解

12 9月10 11月 by helenadmin

python break语句,就像在c语言中,打破了最小封闭for或while循环。break语句用来终止循环 […]

Continue reading
Posted in Python

用python和md5实现网站挂马检测程序

12 9月10 11月 by helenadmin

一、程序测试 代码如下: # python check_change.py usage: python che […]

Continue reading
Posted in Python

pythonpass语句使用示例

12 9月10 11月 by helenadmin

python pass是空语句,pass语句什么也不做,一般作为占位符或者创建占位程序,是为了保持程序结构的完 […]

Continue reading
Posted in Python

python操作数据库之sqlite3打开数据库、删除、修改示例

12 9月10 11月 by helenadmin

代码如下: #coding=utf-8__auther__ = ‘xianbao’im […]

Continue reading
Posted in Python

python去掉字符串中空格的方法

12 9月10 11月 by helenadmin

我们经常在处理字符串时遇到有很多空格的问题,一个一个的去手动删除不是我们程序员应该做的事情,今天这篇技巧的文章 […]

Continue reading
Posted in Python

python自定义函数的创建、调用和函数的参数详解

12 9月10 11月 by helenadmin

函数是组织好的,可重复使用的,用来实现单一,或相关联功能的代码段。函数能提高应用的模块性,和代码的重复利用率。 […]

Continue reading
Posted in Python

使用python判断ip地址合法性的方法实例

12 9月10 11月 by helenadmin

一、使用方法和执行效果请看图:

Continue reading
Posted in Python

python字典(dictionary)操作详解

12 9月10 11月 by helenadmin

python字典是另一种可变容器模型,且可存储任意类型对象,如字符串、数字、元组等其他容器模型。一、创建字典字 […]

Continue reading
Posted in Python

python分析nginx访问日志并保存到mysql数据库实例

12 9月10 11月 by helenadmin

使用python 分析nginx access 日志,根据nginx日志格式进行分割并存入mysql数据库。一 […]

Continue reading
Posted in Python

python调用java的webservice示例

12 9月10 11月 by helenadmin

一、java端首先我使用的是java自带的对webservice的支持包来编写的服务端和发布程序,代码如下。w […]

Continue reading
Posted in Python

python列表(list)操作方法详解

12 9月10 11月 by helenadmin

列表是python中最基本的数据结构,列表是最常用的python数据类型,列表的数据项不需要具有相同的类型。列 […]

Continue reading
Posted in Python

python连接mysql调用存储过程示例

12 9月10 11月 by helenadmin

代码如下: #!/usr/bin/env python# -*- coding: utf8 -*-import […]

Continue reading
Posted in Python

python抓取网页中的图片示例

12 9月10 11月 by helenadmin

代码如下: #coding:utf8import reimport urllibdef gethtml(url […]

Continue reading
Posted in Python

python遍历文件夹并删除特定格式文件的示例

12 9月10 11月 by helenadmin

代码如下: #!/usr/bin/python# -*- coding: utf-8 -*- import o […]

Continue reading
Posted in Python

python为tornado添加recaptcha验证码功能

12 9月10 11月 by helenadmin

代码如下: from urllib.request import urlopen from urllib.pa […]

Continue reading
Posted in Python

python使用cookielib库示例分享

12 9月10 11月 by helenadmin

该模块主要功能是提供可存储cookie的对象。使用此模块捕获cookie并在后续连接请求时重新发送,还可以用来 […]

Continue reading
Posted in Python

python实现博客文章爬虫示例

12 9月10 11月 by helenadmin

代码如下: #!/usr/bin/python#-*-coding:utf-8-*-# jcrawler# a […]

Continue reading
Posted in Python

python处理中文编码和判断编码示例

12 9月10 11月 by helenadmin

下面所说的都是针对python2.7 代码如下: #coding:utf-8#chardet 需要下载安装 i […]

Continue reading
Posted in Python

python实现360的字符显示界面

12 9月10 11月 by helenadmin

代码如下: #!/usr/bin/python #-*-coding:utf-8-*- from push_b […]

Continue reading
Posted in Python

python多进程通信模块的简单实现

12 9月10 11月 by helenadmin

多进程通信方法好多,不一而数。刚才试python封装好嘅多进程通信模块 multiprocessing.con […]

Continue reading
Posted in Python

python控制台显示时钟的示例

12 9月10 11月 by helenadmin

代码如下: #!/usr/bin/env python# coding: utf-8### show time […]

Continue reading
Posted in Python

python文件读写并使用mysql批量插入示例分享(python操作mysql)

12 9月10 11月 by helenadmin

代码如下: # -*- coding: utf-8 -*-”’created on 2 […]

Continue reading
Posted in Python

python3访问sina首页中文的处理方法

12 9月10 11月 by helenadmin

代码如下: “””如果只用普通的import urllib.request […]

Continue reading
Posted in Python

python实现bitmap数据结构详解

12 9月10 11月 by helenadmin

bitmap是很常用的数据结构,比如用于bloom filter中;用于无重复整数的排序等等。bitmap通常 […]

Continue reading
Posted in Python

python使用win32com在百度空间插入html元素示例

12 9月10 11月 by helenadmin

代码如下: from win32com.client import dispatcheximport time […]

Continue reading
Posted in Python

python原始套接字编程示例分享

12 9月10 11月 by helenadmin

下面开始构造http数据包, ip层和tcp层使用python的impacket库,http内容自行填写。 代 […]

Continue reading
Posted in Python

python类参数self使用示例

12 9月10 11月 by helenadmin

代码如下: #coding:utf-8″””__new__和__init_ […]

Continue reading
Posted in Python

python动态监控日志内容的示例

12 9月10 11月 by helenadmin

日志文件一般是按天产生,则通过在程序中判断文件的产生日期与当前时间,更换监控的日志文件程序只是简单的示例一下, […]

Continue reading
Posted in Python

python定时器使用示例分享

12 9月10 11月 by helenadmin

代码如下: class sltimer(multiprocessing.process): #from dat […]

Continue reading
Posted in Python

python求素数示例分享

12 9月10 11月 by helenadmin

代码如下: # 判断是否是素数def is_sushu(num): res=true for x in ran […]

Continue reading
Posted in Python

python实现倒计时的示例

12 9月10 11月 by helenadmin

代码如下: import timecount = 0 a = input(‘time:&#8217 […]

Continue reading
Posted in Python

python检测服务器是否正常

12 9月10 11月 by helenadmin

经常使用python检测服务器是否能ping通, 程序是否正常运行(检测对应的端口是否正常) 以前使用shel […]

Continue reading
Posted in Python

python实现排序算法

12 9月10 11月 by helenadmin

代码如下: def insertion_sort(n): if len(n) == 1: return n b […]

Continue reading
Posted in Python

python根据距离和时长计算配速示例

12 9月10 11月 by helenadmin

代码如下: function cal_pace(d,h,m,s){ var distance = d; var […]

Continue reading
Posted in Python

python时间整形转标准格式的示例分享

12 9月10 11月 by helenadmin

代码如下: import osimport sysimport pickleimport stringimpo […]

Continue reading
Posted in Python

python根据经纬度计算距离示例

12 9月10 11月 by helenadmin

代码如下: /** * 计算两点之间距离 * @param _lat1 – start纬度 * @ […]

Continue reading
Posted in Python

python操作列表的常用方法分享

12 9月10 11月 by helenadmin

下面列出列表常用的方法操作列表以及小例子:1. append 在列表末尾添加元素,需在列表末尾添加元素,需要注 […]

Continue reading
Posted in Python

python转换摩斯密码示例

12 9月10 11月 by helenadmin

代码如下: code = {‘a’: ‘.-‘, &#8216 […]

Continue reading
Posted in Python

python基础教程之lambda表达式使用方法

12 9月10 11月 by helenadmin

python中,如果函数体是一个单独的return expression语句,开发者可以选择使用特殊的lamb […]

Continue reading
Posted in Python

python访问sqlserver示例

12 9月10 11月 by helenadmin

最近遇到了python访问sqlserver的问题,这里总结下。 一、windows下配置python访问sq […]

Continue reading
Posted in Python

python中的yield使用方法

12 9月10 11月 by helenadmin

今天在看其他同事的代码时,发现一个没使用过的python关键字 :yield 先问了一下同事,听他说了几句,有 […]

Continue reading
Posted in Python

python3.3实现乘法表示例

12 9月10 11月 by helenadmin

代码如下: from stringhelper import padleft for x in range(1 […]

Continue reading
Posted in Python

python基础教程之获取本机ip数据包示例

12 9月10 11月 by helenadmin

这几天用到了raw socket,用python写了些demo程序,这里记录下。 首先我们看一个简单的snif […]

Continue reading
Posted in Python

python网络爬虫采集联想词示例

12 9月10 11月 by helenadmin

python爬虫_采集联想词代码 代码如下: #coding:utf-8import urllib2impor […]

Continue reading
Posted in Python

python基础教程之实现石头剪刀布游戏示例

12 9月10 11月 by helenadmin

下面是规则.你和你的对手,在同一时间做出特定的手势,必须是下面一种手势:石头,剪子,布.胜利者从下面的规则中产 […]

Continue reading
Posted in Python

python命令行参数sys.argv使用示例

12 9月10 11月 by helenadmin

代码如下: #diff.py#!/bin/env python import sys if len(sys.a […]

Continue reading
Posted in Python

python网页请求urllib2模块简单封装代码

12 9月10 11月 by helenadmin

对python网页请求模块urllib2进行简单的封装。 例子: 代码如下: #!/usr/bin/pytho […]

Continue reading
Posted in Python

python使用递归解决全排列数字示例

12 9月10 11月 by helenadmin

第一种方法:递归 代码如下: def perms(elements): if len(elements)

Continue reading
Posted in Python

python删除文件示例分享

12 9月10 11月 by helenadmin

删除文件 代码如下: os.remove( filename ) # filename: “要删除 […]

Continue reading
Posted in Python

python解析xmlpython模块xml.dom解析xml实例代码

12 9月10 11月 by helenadmin

一 、python模块 xml.dom 解析xml的apiminidom.parse(filename)加载读 […]

Continue reading
Posted in Python

python基础教程之python消息摘要算法使用示例

12 9月10 11月 by helenadmin

代码如下: #! /usr/bin/python”’ file : testhash. […]

Continue reading
Posted in Python

python合并文本文件示例

12 9月10 11月 by helenadmin

python实现两个文本合并 employee文件中记录了工号和姓名 代码如下: cat employee.t […]

Continue reading
Posted in Python

python使用os模块的os.walk遍历文件夹示例

12 9月10 11月 by helenadmin

代码如下: #-*- coding:utf-8 -*- import os if __name__ == &# […]

Continue reading
Posted in Python

python实现哈希表

12 9月10 11月 by helenadmin

代码如下: #! /usr/bin/env python#coding=utf-8#实现哈希表(线性地址再散列 […]

Continue reading
Posted in Python

python目录操作之python遍历文件夹后将结果存储为xml

12 9月10 11月 by helenadmin

linux服务器有centos、fedora等,都预先安装了python,版本从2.4到2.5不等,而wind […]

Continue reading
Posted in Python

python处理cookie详解

12 9月10 11月 by helenadmin

要在用户浏览器上安装cookie,http服务器向http响应添加类似以下内容的http报头: 代码如下: s […]

Continue reading
Posted in Python

python3使用urllib示例取googletranslate(谷歌翻译)

12 9月10 11月 by helenadmin

代码如下: #!/usr/bin/env python3# -*- coding: utf-8 -*-# fi […]

Continue reading
Posted in Python

python使用urllib模块和pyquery实现阿里巴巴排名查询

12 9月10 11月 by helenadmin

urllib基础模块的应用,通过该类获取到url中的html文档信息,内部可以重写代理的获取方法 代码如下: […]

Continue reading
Posted in Python

使用go和python递归删除.dsstore文件的方法

12 9月10 11月 by helenadmin

python版本: 代码如下: #!/usr/bin/env pythonimport os, sys;def […]

Continue reading
Posted in Python

python的urllib模块显示下载进度示例

12 9月10 11月 by helenadmin

代码如下: def report_hook(count, block_size, total_size):&# […]

Continue reading
Posted in Python

python中for循环详解

12 9月10 11月 by helenadmin

与其它大多数语言一样,python 也拥有 for 循环。你到现在还未曾看到它们的唯一原因就是,python […]

Continue reading
Posted in Python

python在命令行下使用google翻译(带语音)

12 9月10 11月 by helenadmin

说明1. 使用google翻译服务获得翻译和语音;2. 使用mplayer播放获得的声音文件,因此,如果要播放 […]

Continue reading
Posted in Python

c++生成dll使用python调用dll的方法

12 9月10 11月 by helenadmin

第一步,建立一个cpp的dll工程,然后写如下代码,生成dll 代码如下: #include #define […]

Continue reading
Posted in Python

python支持断点续传的多线程下载示例

12 9月10 11月 by helenadmin

代码如下: #! /usr/bin/env python#coding=utf-8 from __future […]

Continue reading
Posted in Python

python获取豆瓣电影简介代码分享

12 9月10 11月 by helenadmin

代码如下: #!/usr/bin/env python#coding:utf-8import re,sysim […]

Continue reading
Posted in Python

python获得图片base64编码示例

12 9月10 11月 by helenadmin

代码如下: #!/usr/bin/env python# -*- coding: utf-8 -*- impo […]

Continue reading
Posted in Python

linux系统使用python获取内存使用信息脚本分享

12 9月10 11月 by helenadmin

代码如下: #!/usr/bin/env python from __future__ import prin […]

Continue reading
Posted in Python

python构造icmpecho请求和实现网络探测器功能代码分享

12 9月10 11月 by helenadmin

python发送icmp echo requesy请求 代码如下: import socketimport s […]

Continue reading
Posted in Python

linux系统使用python监控apache服务器进程脚本分享

12 9月10 11月 by helenadmin

crtrl.py监控apache服务器进程的python 脚本 代码如下: !/usr/bin/env pyt […]

Continue reading
Posted in Python

python发腾讯微博代码分享

12 9月10 11月 by helenadmin

代码如下: import urllib.parse,os.path,time,sys,re,urllib.re […]

Continue reading
Posted in Python

python获取当前时间的方法

12 9月10 11月 by helenadmin

我有的时候写程序要用到当前时间,我就想用python去取当前的时间,虽然不是很难,但是老是忘记,用一次丢一次, […]

Continue reading
Posted in Python

python实现2014火车票查询代码分享

12 9月10 11月 by helenadmin

代码基于python3.3.3,pyqt5.1.1 代码如下: # -*- coding: utf-8 -*- […]

Continue reading
Posted in Python

python生成随机数的方法

12 9月10 11月 by helenadmin

如果你对在python生成随机数与random模块中最常用的几个函数的关系与不懂之处,下面的文章就是对pyth […]

Continue reading
Posted in Python

python模拟登陆tom邮箱示例分享

12 9月10 11月 by helenadmin

代码如下: def logintom(username, password): url1 = ”& […]

Continue reading
Posted in Python

python发送伪造的arp请求

12 9月10 11月 by helenadmin

代码如下: #!/usr/bin/env pythonimport socket s = socket.soc […]

Continue reading
Posted in Python

python正则匹配查询港澳通行证办理进度示例分享

12 9月10 11月 by helenadmin

代码如下: import socketimport re ”’广东省公安厅出入境政务服 […]

Continue reading
Posted in Python

python模拟新浪微博登陆功能(新浪微博爬虫)

12 9月10 11月 by helenadmin

1、主函数(weibomain.py): 代码如下: import urllib2import cookiel […]

Continue reading
Posted in Python

python模拟登录百度代码分享(获取百度贴吧等级)

12 9月10 11月 by helenadmin

代码如下: # -*- coding: utf8 -*-”’created on 20 […]

Continue reading
Posted in Python

文章导航

Previous 1 2 3 4 5 6 7 8 … 78 Next

近期文章

  • python selenium 采集百家号文章
  • 嫦娥五号完成月球钻取采样及封装
  • 如何用GAN做语义分割
  • 从源码学习Transformer!
  • TensorFlow 2.0入门指南

近期评论

  • helenadmin发表在《ES(ElasticSearch)分布式全文搜索引擎及使用方式》
  • πιστοποιητικο υγειας发表在《redis队列操作》
  • chat webcam发表在《php代码优化点》
  • Darby发表在《成人影片制作商:VR可以提高性生活质量》
  • creapublicidadonline.es发表在《golang语言的特性》

文章归档

  • 2021年一月
  • 2020年十二月
  • 2020年十一月
  • 2020年十月
  • 2020年九月
  • 2020年八月
  • 2020年七月
  • 2020年六月
  • 2020年五月
  • 2020年四月
  • 2020年三月
  • 2020年二月
  • 2020年一月
  • 2019年十二月
  • 2019年十一月
  • 2019年十月
  • 2019年九月
  • 2019年八月
  • 2019年七月
  • 2019年六月
  • 2019年五月
  • 2019年四月
  • 2019年三月
  • 2019年二月
  • 2019年一月
  • 2018年十二月
  • 2018年十一月
  • 2018年十月
  • 2018年九月
  • 2018年七月
  • 2018年六月
  • 2018年三月
  • 2018年二月
  • 2018年一月
  • 2017年十二月
  • 2017年十一月
  • 2017年十月
  • 2017年九月
  • 2017年八月
  • 2017年七月
  • 2017年六月
  • 2017年五月
  • 2017年四月
  • 2017年三月
  • 2017年一月
  • 2016年十二月
  • 2016年十一月
  • 2016年十月
  • 2016年九月
  • 2016年八月
  • 2016年七月
  • 2016年六月
  • 2016年五月
  • 2016年四月
  • 2016年三月
  • 2016年二月
  • 2015年八月
  • 2015年七月
  • 2015年六月
  • 2015年五月
  • 2014年七月
  • 2014年六月
  • 2014年五月
  • 1970年一月

分类目录

  • Database
  • focus—-实时热搜
  • js&jquery
  • PHP
  • Python
  • 新技术研习
  • 服务器相关技术
  • 算法
  • 缓存技术
  • 随笔

功能

  • 登录
  • 文章RSS
  • 评论RSS
  • WordPress.org
© 2021 charlie笔记 ·
程序猿 散文朗诵 佛学网