Python
文章平均质量分 50
小白笑苍
沉默是一种生活方式。
展开
-
一个简单的抓取百度热度数据并可视化的demo
可视化工具https://github.com/Jannchie/Historical-ranking-data-visualization-based-on-d3.js比如抓取2011-2020 100多位日本女星的百度热度数据female_japanese_hot_rank.pyfrom get_index import BaiduIndeximport csv# 可以 from...原创 2020-05-03 11:19:06 · 3293 阅读 · 0 评论 -
Grab picture with window's handle
# 对后台应用程序截图,程序窗口可以被覆盖,但如果最小化后只能截取到标题栏、菜单栏等。import win32guiimport win32uiimport win32confrom ctypes import windllfrom PIL import Image# 获取要截取窗口的句柄hwnd = win32gui.FindWindow("Afx:000c0000:3:0001...原创 2018-07-04 17:52:34 · 296 阅读 · 0 评论 -
anaconda安装tensorflow-(转)
anaconda安装tensorflow <div class="postBody"> <div id="cnblogs_post_body" class="blogpost-body"><p>python环境:win10 64下anacond..转载 2018-03-01 17:25:15 · 254 阅读 · 0 评论 -
使用Python爬虫+SMTP打造‘自动告白邮件脚本'
有一天在逛知乎可以用 Python 编程语言做哪些神奇好玩的事情?发现一条有趣的评论,说是通过python实现每日向女票(当然你也可以发给你的基友)发送一封爱意满满的邮件,当时觉得挺有趣的,于是就照模照样的也用python实现一次。整个代码的思路也很简单。爬取数据、云储存获取数据——整理排版——邮件发送。先放张效果图:本次实例用到的框架有:leancloud、requests、lx...转载 2018-02-18 19:17:56 · 1634 阅读 · 0 评论 -
Python爬虫入门——爬取贴吧图片
最近忽然想听一首老歌,“I believe” 于是到网上去搜,把几乎所有的版本的MV都看了一遍(也是够无聊的),最喜欢的还是最初版的《我的野蛮女友》电影主题曲的哪个版本,想起女神全智贤,心血来潮,于是就想到了来一波全MM的美照,哪里有皂片呢?自然是百度贴吧了。放上链接-————[plain] view plain copy pri...转载 2018-02-18 19:16:33 · 2553 阅读 · 2 评论 -
The Spelling Corrector by python
在学习卷积神经网络的时候,遇到这个问题:from theano.tensor.signal.pool import downsampleImportError: cannot import name downsample解决方案来自大牛的回复 [http://blog.csdn...转载 2018-02-08 16:52:36 · 206 阅读 · 0 评论 -
The Spelling Corrector by python
Learned by How to Write a Spelling Corrector.You can get the detailed course in this article.The related Dic is the big.txtThe code is so fantastic~:import refrom collections import Counterde...原创 2018-02-08 15:19:50 · 379 阅读 · 0 评论 -
Face detection demo code by python
A demo code about the face detection:# import library - MUST use cv2 if using opencv_traincascadeimport cv2# rectangle color and strokecolor = (0, 0, 255) # reverse of RGB (B,G,R) - weirdstr...原创 2018-02-08 10:35:45 · 544 阅读 · 0 评论 -
Craw the picture of the specific handle
Here is the demo code to Craw the picture of the specific handle in windows:import timeimport win32gui, win32ui, win32con, win32apidef window_capture(filename,hwnd): # 根据窗口句柄获取窗口的设备上下文DC(Div原创 2018-02-07 15:28:03 · 227 阅读 · 0 评论 -
Craw the words in the picture and search them
Here is the demo code to craw the words in the picture and then search the words in the browser:from PIL import Imageimport pytesseractimport timefrom selenium import webdriverbegin = time.time(原创 2018-02-07 15:26:30 · 194 阅读 · 0 评论 -
Mouse and keyboard operation in windows using python
using the api of win32. The demo code of operating mouse:import win32api,win32con#鼠标定位到(500,500)win32api.SetCursorPos([500,500])#执行左单键击,若需要双击则延时几毫秒再点击一次即可win32api.mouse_event(win32con.MOUSEE原创 2018-02-07 15:24:14 · 250 阅读 · 0 评论 -
How to get the handle in windows using python
Using the API of win32,the classname can be got through the tool named spy++,titlename is the name of the window.Here is the demo:import win32guiimport win32apiclassname = "ApplicationFrameWind原创 2018-02-07 15:22:12 · 250 阅读 · 0 评论 -
How to install opencv in python
For windows,goto:https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv to download the .whl file you want,and then setup it:pip3 install xxx.whlFor Linux:pip3 install opencv-python原创 2018-02-07 15:17:08 · 252 阅读 · 0 评论 -
Painting with Tensorflow
It is an open source library by tensorflow. Here is the article: https://link.zhihu.com/?target=http%3A//arxiv.org/abs/1508.06576I am learning from it right now.Here is the demo code:from __futu原创 2018-02-07 11:02:05 · 268 阅读 · 0 评论 -
MNIST character judgement demo code
mnist judgement demo codefrom tensorflow.examples.tutorials.mnist import input_dataimport tensorflow as tf#获取mnist数据集mnist = input_data.read_data_sets("/path/to/MNIST_data/",one_hot = True)print(...原创 2018-12-10 15:58:13 · 150 阅读 · 0 评论 -
python win32 operation demo code
python win32 operation demo codeimport win32gui, win32api, win32con# 获取鼠标当前位置的坐标win32api.GetCursorPos()# 将鼠标移动到坐标处win32api.SetCursorPos((200, 200))# 左点击win32api.mouse_event(win32con.MOUSEEVENTF...原创 2019-01-17 16:52:55 · 222 阅读 · 0 评论 -
Python3 * 和 ** 运算符的区别
在 Python 中,* 和 ** 具有语法多义性,具体来说是有四类用法。算数运算代表乘法代表乘方>>> 2 * 510>>> 2 ** 532函数形参*args 和 **kwargs 主要用于函数定义。你可以将不定数量的参数传递给一个函数。不定的意思是:预先并不知道, 函数使用者会传递多少个参数给你, 所以在这个场景下使用这两个...转载 2019-05-29 16:54:37 · 3831 阅读 · 0 评论 -
python docopt
the related URL:pypi_docoptthe introduce video link:docopt videoA demo code"""Naval Fate.Usage: naval_fate.py ship new <name>... naval_fate.py ship <name> move <x> <y>...原创 2019-05-29 16:42:30 · 209 阅读 · 0 评论 -
python __str__ 和 __repr__区别
class Test(object): def __init__(self, value='hello, world!'): self.data = value>>> t = Test()>>> t<__main__.Test at 0x7fa91c307190>>>> print t<__...转载 2019-05-29 16:15:32 · 111 阅读 · 0 评论 -
那些年我们踩过的那些坑
转载:https://blog.csdn.net/jackfrued/article/details/79521404在 Python 中一切都是对象,整数也是对象,在比较两个整数时有两个运算符==和is,它们的区别是:is比较的是两个整数对象的id值是否相等,也就是比较两个引用是否代表了内存中同一个地址。==比较的是两个整数对象的内容是否相等,使用==时其实是调用了对象的__eq__()...转载 2019-05-29 12:25:15 · 417 阅读 · 0 评论 -
关于python中带下划线的变量和函数 的意义
关于python中带下划线的变量和函数 的意义总结:变量:前带_的变量: 标明是一个私有变量, 只用于标明, 外部类还是可以访问到这个变量前带两个_ ,后带两个_ 的变量: 标明是内置变量,大写加下划线的变量: 标明是 不会发生改变的全局变量函数:前带_的变量: 标明是一个私有函数, 只用于标明,前带两个_ ,后带两个_ 的函数: 标明是特殊函数Python 的代码风...转载 2019-05-06 15:37:15 · 208 阅读 · 0 评论 -
迭代(iterable)和迭代器
迭代(iterable)#任何可迭代对象都可以作用于for循环,包括我们自定义的数据类型,只要符合迭代条件,就可以使用for循环d = {'a': 1, 'b': 2, 'c': 3} #对dict迭代for k,v in d.items(): # 如果要同时迭代key和value,可以用for k, v in d.items() print(k,v)#默认情况下,dict迭代的是ke...转载 2019-03-18 17:00:07 · 844 阅读 · 0 评论 -
Python Iterators
python tutorial 9.8By now you have probably noticed that most container objects can be looped over using a for statement:for element in [1, 2, 3]: print(element)for element in (1, 2, 3): pr...转载 2019-03-20 15:47:02 · 1339 阅读 · 0 评论 -
The shuffle algorithm
Today I used the python’s API shuffle(random.shuffle) to resort a list and I am wondering the related algorithm so I find some materials。Fisher-Yates shuffleWrite down the numbers from 1 through N....原创 2019-03-15 16:28:02 · 166 阅读 · 0 评论 -
Python: The fastest way to process large file
Firstly is to make sure the problem is CPU bound or I/O bound. Mine is I/O boundmake a big fileimport timedef creatfilesize(n): local_time = time.strftime("%Y%m%d%H%M%S",time.localtime()) ...原创 2019-03-15 15:26:10 · 258 阅读 · 0 评论 -
Windows10和Visual Studio Code环境中配置使用Git和GitHub
备注:开始使用Visual&nbsp;Studio&nbsp;Code以来,系统每天提示“Git”有关的信息,因为觉得好奇就开始在网上了解、查资料、配置、测试,反正就是反复折腾,N次都失败了,就在打算放弃的时候,在N+1次,也就是刚才(2018年1月19日 14:25)终于成功了,赶紧写下来,梳理梳理,表示记念。另外,希望可以帮助到其他更多...转载 2019-02-20 22:27:48 · 1807 阅读 · 0 评论 -
django source code-http(1)
The source code path:django/django/httpcookie.pyfrom http import cookies# For backwards compatibility in Django 2.1.SimpleCookie = cookies.SimpleCookie# Add support for the SameSite attribute (...原创 2019-02-13 17:52:48 · 260 阅读 · 0 评论 -
Fix the problem ''set object is not reversible" in Django
BackgroundI meet a problem when using Django. The trace is set object is not reversible.reasonIn the file urls.py, the data structure urlpatterns should be the set rather than map, so I need use th...原创 2019-02-19 11:02:36 · 345 阅读 · 0 评论 -
The timeout problem when connecting to the github in pycharm
backgroundI want to connect to the github in my working computer which uses the IDE of Pycharm, but occurs the timeout problem.reasonMy working computer uses the proxy but the Pycharm does not set ...原创 2019-02-11 16:17:47 · 306 阅读 · 0 评论 -
Detect words in the picture using the baidu's api rather than tesseract
Sometimes tesseract does not work well on detecting the words in the picture,especially the colorful words or blurry ones. So I try to find a new way to realize it and there has an baidu’s API which w...原创 2019-01-16 10:06:34 · 153 阅读 · 0 评论 -
How to fix the problem 'Your CPU supports instructions that this TensorFlow binary was not compiled'
When doing the compile of tensorflow,it happens a problem Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2.So how to fix it? Well,just add the code below:原创 2018-02-07 10:57:24 · 402 阅读 · 0 评论 -
Operation about Excel with Python
One of my friends want to analyze the data of a excel file.As before I will use VB to do it ,now I want to try it with python,so I search the related APIs about the Excel file. The purpose is to get原创 2018-02-06 12:09:46 · 192 阅读 · 0 评论 -
How to update pip3 when having both pip2 and pip3
I have both python2.x and python3.x in my os and I want to update my pip3 to the newest.Here pip == pip2.So if I want to upgrade pip3,I find that this command is wrong:pip3 install --upgrade pip3原创 2018-01-29 21:27:18 · 341 阅读 · 0 评论 -
windows系统下Python环境的搭建-(转)
windows系统下Python环境的搭建 <div class="postBody"> <div id="cnblogs_post_body"><p><span style="color:black; font-family:微软雅黑; font-size:13pt"><br>1、首先访问<a href="http://www.python转载 2017-12-01 10:00:47 · 1207 阅读 · 0 评论 -
Somethings about the coding in Python
In python3,the words will be coded in Unicode,so python3 support many languages. - ord():output the int number of a charactor:ord('a')ord('中')chr():output the charactor of a specific codeing number:原创 2017-11-15 16:01:23 · 210 阅读 · 0 评论 -
How to execute the command with root jurisdiction in pyCharm
Today I just want to install a python library in pyCharm with the bottom Alt+Enter but it failed without the root jurisdiction.What i am doing is to change the authority with the command:sudo chmod -R原创 2017-11-28 20:08:52 · 218 阅读 · 0 评论 -
Pycharm编辑器功能之自动导入模块-(轉)
转自:http://blog.csdn.net/u013088062/article/details/50252295 1、导入模块 我们在编程过程中经常会不经意的使用到一些尚未导入的类和模块,在这种情况下Pycharm会帮助我们定位模块文件位置并将其添加到导入列表中,这也就是所谓的自动导入模块功能。 为了研究这个功能,我们借用之前已经编写好的Solver类,输入以下代码: 在输入math.转载 2017-11-28 20:02:05 · 1593 阅读 · 0 评论 -
How to install the pycharm in my ubuntu
Firstly add the source:sudo add-apt-repository ppa:mystic-mirage/pycharmthen if you want to install the professional version:sudo apt updatesudo apt install pycharmor you are a loser and just want the原创 2017-11-10 18:35:08 · 309 阅读 · 0 评论 -
How to uninstall/update/ your python in Linux
If you want to uninstall your python,input:sudo apt-get remove pythonif you want to install python3:sudo apt-get install python3but it just installs the python3.4,so if you want to update it to3.5:sudo原创 2017-11-10 18:10:48 · 772 阅读 · 0 评论 -
A Continuous Integration System
What is a Continuous Integration SystemCI Systems are dedicated systems used to test new code,it is the responsibility of the continuous integration system to verify that this commit will not break any原创 2017-09-03 15:02:03 · 422 阅读 · 0 评论