文章分类 -  python

摘要:转载: https://www.cnblogs.com/youngleesin/p/10447907.html 八种定位元素的方式# 通过id定位元素:find_element_by_id("id_vaule") 通过name定位元素:find_element_by_name("name_vaule 阅读全文
posted @ 2022-03-14 01:40 subsir 阅读(255) 评论(0) 推荐(0) 编辑
摘要:由于微信发送信息是需要先登录,而登录又需要二维码扫码。 所以保证微信不断线或被踢很关键。 曾不信邪,就最用戳的方法定时发送信息保证心跳,还是会在差不多20小时候被踢掉,并且需要再次用二维码扫码登录。 经过多次尝试后,还是妥协用到了多线程。 特将代码记录在这片博文中。 阅读全文
posted @ 2018-12-13 16:09 subsir 阅读(670) 评论(0) 推荐(0) 编辑
摘要:中文分词 对于NLP(自然语言处理)来说,分词是一步重要的工作,市面上也有各种分词库,11款开放中文分词系统比较。 1.基于词典:基于字典、词库匹配的分词方法;(字符串匹配、机械分词法) 2.基于统计:基于词频度统计的分词方法; 3.基于规则:基于知识理解的分词方法。 第一类方法应用词典匹配、汉语词 阅读全文
posted @ 2018-08-16 11:33 subsir 阅读(271) 评论(0) 推荐(0) 编辑
摘要:最近新招的实习生妹子,弄的一个 验证码破解脚本, 据说准确率80% 。 自己已经很少写代码了,就直接贴上实习生MM的脚本 阅读全文
posted @ 2018-07-11 20:44 subsir 阅读(292) 评论(0) 推荐(0) 编辑
摘要:对python内置的数据类型进行转换时,可以使用内置函数,常用的类型转换函数如下 阅读全文
posted @ 2018-02-09 18:11 subsir 阅读(155) 评论(0) 推荐(0) 编辑
摘要:转载:https://www.cnblogs.com/Chenjiabing/p/6907397.html 看了好几个博文,就这个最全啦。。 所以直接转载过来,便于自己查阅。 安装 cmd: pip install itchat 登录 itchat.auto_login() 这种方法将会通过微信扫描 阅读全文
posted @ 2018-02-08 16:31 subsir 阅读(453) 评论(0) 推荐(0) 编辑
摘要:转载: https://zhuanlan.zhihu.com/p/26514576?group_id=839173221667446784 1、安装扩展包 cmd:pip install itchat 1. 微信好友男女比例 想统计下自己微信里好友的性别比例,当然也是很简单,先获取好友列表,统计列表 阅读全文
posted @ 2018-02-08 16:08 subsir 阅读(220) 评论(0) 推荐(0) 编辑
摘要:转载:https://zhuanlan.zhihu.com/p/21563130 GUI 图形界面 Tkinter : Tkinter wxPython: wxPython PyGTK: PyGTK PyQt: PyQt PySide: PySide Web框架 django: django web 阅读全文
posted @ 2018-02-08 15:58 subsir 阅读(225) 评论(0) 推荐(0) 编辑
摘要:转载: https://www.cnblogs.com/wangls/p/7057570.html 最近基于个人工作情况,经常需要给业务方提供一些数据,而临近春节需要休假一段时间,所以想到了能否通过python来自动将信息转发到微信上。 1、安装 cmd: pip install itchat 2、 阅读全文
posted @ 2018-02-08 15:52 subsir 阅读(1223) 评论(0) 推荐(0) 编辑
摘要:1 准备连接hive的python代码在使用Python连接hive之前需要将hive中的文件拷贝到python的sys.path中cp -r $HIVE_PATH/lib/py /usr/local/lib/python2.7/site-packages或者将hive中连接代码,设法加入到python的eclipse项目中总之,目的只有一个,就是用hive自己提供的python客户端代码,来连接hive关于具体如果将第三方的python代码加入环境变量,可以参照python中添加环境变量2 启动hive 的thrift如果hive机器没有thrift请先安装,确保以下服务开启:hive .. 阅读全文
posted @ 2014-04-01 21:14 subsir 阅读(2612) 评论(0) 推荐(0) 编辑
摘要:easy_install 简介easy_install与yum类似,使用easy_install,可以轻松在pypi软件库里面搜索python各类软件easy_install是由PEAK(Python Enterprise Application Kit)开发的setuptools包里带的一个命令,所以使用easy_install实际上是在调用setuptools来完成安装模块的工作。 Perl 用户比较熟悉 CPAN,而 Ruby 用户则比较熟悉 Gems;引导setuptools的ez_setup工具和随之而生的扩展后的easy_install 与 “Cheeseshop”(Python 阅读全文
posted @ 2014-04-01 21:13 subsir 阅读(387) 评论(0) 推荐(0) 编辑
摘要:import syssys.path系统环境是一个list,可以将自己需要的库添加进入,例如mysql库,hive库等等。有三种方式添加,均验证通过:1 临时添加,在一个shell窗口中import syssys.pathsys.path.append(path)但退出该shell窗口,即失效2 使用pth文件永久添加使用pth文件,在 site-packages 文件中创建 .pth文件,将模块的路径写进去,一行一个路径,以下是一个示例,pth文件也可以使用注释:# .pth file for the my project(这行是注释)E:\DjangoWordE:\DjangoWord\m 阅读全文
posted @ 2014-04-01 21:07 subsir 阅读(1364) 评论(0) 推荐(0) 编辑
摘要:一、Python中的线程使用:Python中使用线程有两种方式:函数或者用类来包装线程对象。1、函数式:调用thread模块中的start_new_thread()函数来产生新线程。如下例:view plaincopy to clipboardprint?importtimeimportthreaddeftimer(no,interval):cnt=0whilecnt=5:print'Thread%sreleased!num=%s'%(name,str(num))mylock.release()thread.exit_thread()num+=1print'Thread 阅读全文
posted @ 2014-03-18 11:28 subsir 阅读(161) 评论(0) 推荐(0) 编辑
摘要:sudo yum -y install python-devel openssl openssl-devel gcc sqlite-develwget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgztar -xvj Python-2.7.6.tgzcd Python-2.7.6./configure --prefix=/usr/local/python2.7 --with-threads --enable-sharedsudo makesudo make install altinstallsudo ln -s /usr/loca 阅读全文
posted @ 2014-03-18 11:24 subsir 阅读(160) 评论(0) 推荐(0) 编辑
摘要:python中对文件、文件夹的操作需要涉及到os模块和shutil模块。创建文件:1) os.mknod("test.txt") 创建空文件2) open("test.txt",w) 直接打开一个文件,如果文件不存在则创建文件创建目录:os.mkdir("file") 创建目录复制文件:shutil.copyfile("oldfile","newfile") oldfile和newfile都只能是文件shutil.copy("oldfile","newfile&qu 阅读全文
posted @ 2014-03-06 10:13 subsir 阅读(203) 评论(0) 推荐(0) 编辑
摘要:当初学 Python 时,想要弄懂 Python 的错误信息的含义可能有点复杂。这里列出了常见的的一些让你程序 crash 的运行时错误。1)忘记在if,elif,else,for,while,class,def声明末尾添加 :(导致 “SyntaxError :invalid syntax”)该错误将发生在类似如下代码中:if spam == 42 print('Hello!')2)使用 = 而不是 ==(导致“SyntaxError: invalid syntax”)= 是赋值操作符而 == 是等于比较操作。该错误发生在如下代码中:if spam = 42: print(& 阅读全文
posted @ 2014-03-04 10:14 subsir 阅读(202) 评论(0) 推荐(0) 编辑