用Python写了个根据基本码表生成词组码表的工具
摘要:『快码』码表生成工具 建立一个基本的单字码表文件,使用UTF8格式保存为文本文件,中间用空格间隔,如base.txt: 中 zlh 华 hkgs 人 rk 民 mbg 共 gtk 和 hfl 国 glah 再建立一个要编码的词库文件,同样使用UTF8格式保存为文本文件,中间用空格间隔,如source
阅读全文
posted @
2022-09-29 16:27
garfieldtom
阅读(135)
推荐(0) 编辑
使用Python获取当前Bing的背景图片并设置为Windows壁纸
摘要:下面的代码在我写此博客时编辑通过,很简单,如果Bing的背景图片格式发生变化,请修改对应的正则匹配代码即可。 # # Name: BingWallPaper# Purpose:## Author: xxh## Created: 28-03-2022# Copyright: (c) xxh 2022#
阅读全文
posted @
2022-03-28 08:20
garfieldtom
阅读(86)
推荐(0) 编辑
python发起https请求
摘要:import urllib.request import ssl ssl._create_default_https_context = ssl._create_unverified_context response = urllib.request.urlopen('https://www.bai
阅读全文
posted @
2021-04-22 16:53
garfieldtom
阅读(1172)
推荐(0) 编辑
sqlalchemy 执行原生sql语句(转)
摘要:转自: https://www.cnblogs.com/wt7018/p/11617878.html 1、方式一 # 查询 cursor = session.execute('select * from users') result = cursor.fetchall() # 添加 cursor =
阅读全文
posted @
2020-03-14 06:52
garfieldtom
阅读(687)
推荐(0) 编辑
python操作mysql(ORM)(转)
摘要:1.https://www.baidu.com/link?url=YPRHwbVIUWG08RvvQnigWIDAwO6ml61SQwnA2KyQkSwKe0Djcp2NNOkXKz422GNL&wd=&eqid=bdd8b5890004f6e6000000025e6b42c8 安装方法pip in
阅读全文
posted @
2020-03-13 16:26
garfieldtom
阅读(278)
推荐(0) 编辑
Python Selenium 测试
摘要:python下安装selenium包,然后根据浏览器版本下载对应支持程序,写了个简单的测试。 webdriver驱动下载: Chrome 点击下载chrome的webdriver: http://chromedriver.storage.googleapis.com/index.html 不同的Ch
阅读全文
posted @
2020-03-13 16:17
garfieldtom
阅读(146)
推荐(0) 编辑
Python抓取豆瓣Top250电影信息
摘要:买了本书,《Python 3.5从零开始学》,根据书中例程改写了一个抓取豆瓣Top250电影信息的小爬虫练练手,完成了爬取信息写入文件,Linux下编译通过。 #!/usr/bin/python3 # *_* coding:utf8 *_* from urllib import request fr
阅读全文
posted @
2020-03-13 16:10
garfieldtom
阅读(220)
推荐(0) 编辑
第一个Python+Selenium程序
摘要:先安装好环境,测试第一个简单程序: # -*- coding: utf8 -*- from selenium import webdriver #使用Chrome #ChromeDriverServer="E:\\MySoftGit\\Python\\Selenium\\chromedriver.e
阅读全文
posted @
2020-03-03 21:18
garfieldtom
阅读(199)
推荐(0) 编辑
整理打印PI值
摘要:准备锻炼背诵PI的小数,找到PI值:PI=3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446...
阅读全文
posted @
2015-02-05 16:40
garfieldtom
阅读(1013)
推荐(1) 编辑
python+stomp+activemq
摘要:python也可以连接MQ,以ActiveMQ为例,安装stomp.py:https://github.com/jasonrbriggs/stomp.py下载后安装:python setup.py install很简单,然后一个简单的示例:import timeimport sysimport st...
阅读全文
posted @
2014-12-09 19:10
garfieldtom
阅读(6299)
推荐(0) 编辑
我的第一个Raspberry PI装置
摘要:好吧,我先承认是这是从书上学习的第一个示例。我入手的是Raspberry红版,版本2,看到这么小巧的卡片电脑可以做这么多事情,真是让人惊喜!安装系统等都很顺利,启动、安装程序、远程桌面、SSH登录等都很顺利,就是安装XBMC不行,各种版本都不行,启动起来后操作不一会就挂掉了,不知道是什么原因,电源没...
阅读全文
posted @
2014-07-03 16:29
garfieldtom
阅读(454)
推荐(0) 编辑
python正则检测密码合法性
摘要:客户系统升级,要求用户密码符合一定的规则,即:包含大小写字母、数字、符号,长度不小于8,于是先用python写了个简单的测试程序:#encoding=utf-8#---------------------------------------------------------------------...
阅读全文
posted @
2014-06-10 15:58
garfieldtom
阅读(5318)
推荐(0) 编辑
python调用Delphi写的Dll
摘要:Delphi单元如下(输出hello.dll):unit hellofun;interfacefunction getint():integer;stdcall;function sayhello(var sname:PAnsiChar):PAnsiChar;stdcall;implementationfunction getint():integer;stdcall;begin result:=888;end;function sayhello(var sname:PAnsiChar):PAnsiChar;stdcall;begin sname:='ok!'; result:
阅读全文
posted @
2013-03-15 19:03
garfieldtom
阅读(2423)
推荐(0) 编辑
window7下安装IPython
摘要:IPython是很好的Python交互工具,于是试着在Windows7下安装.相关资源连接:官网:http://ipython.org/github:https://github.com/ipython/ipythonPyPi:http://pypi.python.org/pypi/ipython先是下载了IPython For Python3的安装版本,安装完毕后运行报告错误,修改了readline.py中的一个字符串定义错误后可以运行了,但没有语法高亮及代码自动完成,于是下载IPython的代码,手工安装,安装完毕后还是没有没有语法高亮及代码自动完成.需要再安装pyreadline,于是下
阅读全文
posted @
2013-01-26 17:27
garfieldtom
阅读(8068)
推荐(0) 编辑
Python删除Delphi临时文件的小脚本
摘要:Delphi在编译过程中会产生很多临时文件,写了个Python脚本,用于删除这些临时文件.上代码:#-------------------------------------------------------------------------------# Name: DelDelphiTempFile.py# Purpose:# 删除Delphi临时文件脚本# Author: garfield## Created: 26-01-2013# Copyright: (c) garfield 2013# Licence: <your licence>...
阅读全文
posted @
2013-01-26 14:44
garfieldtom
阅读(1081)
推荐(0) 编辑
Python For Delphi---更好地协同(续)
摘要:Delphi通过PythonForDelphi变量来和Python交换数据可以,有没有别的办法了呢?有,可以像COM一样来调用Python模块的变量和函数,这看起来好像能更酷一些 :-)感谢samson,是他的一篇文章使我学习到了这个方法,并且很热心地给予了指教!废话少说,先上Python代码(hello.py,放到程序目录下):strPython='Hello,This is a python string !'dicPython={'StringInfo':'Hello,This is a python string !'}lstPython
阅读全文
posted @
2013-01-17 15:30
garfieldtom
阅读(6797)
推荐(0) 编辑
Python For Delphi---更好地协同
摘要:先上相关资源的下载吧:python4delphi:主页:http://code.google.com/p/python4delphi/下载:svn checkouthttp://python4delphi.googlecode.com/svn/trunk/ python4delphi-read-only现在已支持到XE2.必看(作者):http://www.atug.com/andypatterns/pythonDelphiTalk.htm下面要示范的就是在XE2下完成.其实源码检出后,里面有30多个示例,几乎涵盖了Python4Delphi的所有方面.好吧,我们下面做个简单的加法计算器,主要
阅读全文
posted @
2013-01-14 18:49
garfieldtom
阅读(6923)
推荐(0) 编辑
Python Socket学习
摘要:Python在网络通讯方面功能强大,学习一下Socket通讯的基本方式UDP通讯:Server:import socketport=8081s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)#从指定的端口,从任何发送者,接收UDP数据s.bind(('',port))print('正在等待接入...')while True: #接收一个数据 data,addr=s.recvfrom(1024) print('Received:',data,'from',addr)Client:imp
阅读全文
posted @
2012-12-16 07:14
garfieldtom
阅读(77423)
推荐(10) 编辑
有趣的python精短程序
摘要:python可以简单优美,也很有趣,下面是收集的例子:1.一句话开始一个http的文件服务器:$ python -m SimpleHTTPServerServing HTTP on 0.0.0.0 port 8000 ...在浏览器中就可以http://localhost:8000访问目录及文件了。...
阅读全文
posted @
2012-12-06 22:36
garfieldtom
阅读(12229)
推荐(0) 编辑