strip()函数的目的是去除字符串中的首位符号中间位置的符号不管用In[68]:"Stripfuction".strip()Out[68]:'Stripfuction'In[72]:"\tStripfuction\n".strip()Out[72]:'Stripfuction'In[73]:"\tStrip\nfuction\n".strip()Out[73]:'Strip\nfuction'
系统 2019-09-27 17:50:39 2344
生成模拟数据编写generate_log.py#coding=UTF-8importrandomimporttimeurl_paths=["class/112.html","class/128.html","class/145.html","class/130.html","class/146.html","class/131.html","learn/821","course/list"]ip_slices=[132,156,124,10,29,167,
系统 2019-09-27 17:50:31 2344
阅读更多Python调用hanlp的方法此前有分享过,本篇文章分享自“逍遥自在017”的博客,个别处有修改,阅读时请注意!1.首先安装jpype首先各种坑,jdk和python版本位数必须一致,我用的是JPype1-py3版本号0.5.5.2、1.6jdk和Python3.5,win764位下亲测没问题。否则死翘翘,有可能虚拟机都无法启动:出错调试,原因已说;测试成功会有输出。下面启动虚拟机跑hanlp2.下载各种安装包使用自定义的HanLP——HanLP
系统 2019-09-27 17:50:20 2344
图片版PDF无法复制,转化成文字版的PDF后使用更方便.我们需要用到python3.6,pypdf2,ghostscript,PythonMagick,百度文字识别服务和pdfkit.安装安装python3.6略安装ghostscripthttps://ghostscript.com/download/gsdnld.html安装wkhtmltopdfhttps://wkhtmltopdf.org/downloads.htmlpip安装PyPDF2,ghos
系统 2019-09-27 17:49:31 2344
离线批量下载,首先可以使用:pipfreeze>requirements.txt可以将其中的==改成>=,批量修改即可使用命令,把下载的库放入dependency文件夹下:中途可能因为网络原因下载失败,再次执行该命令即可,已经下载好的包不会重复下载pipdownload-ddependency-rrequirements.txt批量离线安装:pipinstall--no-index--find-links=安装包路径-rrequirements.txt下载
系统 2019-09-27 17:47:58 2344
importosimportsocketfile_path=os.getcwd()print('目录'+file_path+'中的文件包括:')print_dir_files(file_path)#print('***获取当前目录***')#print(os.getcwd())print(os.path.abspath(os.path.dirname(__file__)))print('***获取上级目录***')#print(os.path.abspat
系统 2019-09-27 17:47:46 2344
python&&多线程多进程及主机管理&&学习笔记多线程知识回顾关于python"假线程"的说法python是非线程安全的语言基本多进程示例基本多进程示例2多进程之进程间通讯示例1多进程间内存共享示例1多进程之进程间通讯示例2多进程间内存共享示例2多进程间内存共享示例3进程池Pool利用pool产生多进程示例多进程多线程执行示例1IT审计堡垒机的开发示例审计堡垒机的安全控制shellinaboxd异步Select、poll&epoll(异步IO模型)sel
系统 2019-09-27 17:47:38 2344
#!/usr/bin/envpython#coding:utf8importos,sysimportmd5,tabfrommysql_co.my_dbimportset_mysqlfromssh_co.ssh_connectimportsshdfromssh_co.cfg.configimportssh_message,item_pathfromfileimportfindfiledefmy_mysql():db_file={}my_connect=set
系统 2019-09-27 17:45:42 2344
基本命令显示版本信息pip-V安装指定包pipinstallpipinstall-i'host'指定下载源卸载指定包pipuninstall列出已安装的包piplist显示有关已安装包的信息pipshow查找指定包pipsearch修改下载源Linuxvim~/.pip/pip.conf#编辑用户目录下隐藏的配置文件,没有的话生成一个格式如下:[global]index-url=http://mirrors.aliyun.com/pypi/simple/[
系统 2019-09-27 17:45:41 2344
Trifinder事件实例实例展示Trifinder对象对的使用。当鼠标移动到一个被分割的三角形上,这个三角形高亮显示,并且它的标签在图标题显示。展示下演示结果:完整代码:importmatplotlib.pyplotaspltfrommatplotlib.triimportTriangulationfrommatplotlib.patchesimportPolygonimportnumpyasnpdefupdate_polygon(tri):iftri=
系统 2019-09-27 17:38:42 2344