作家
登录

那些有趣/用的Python库

作者: 来源: 2017-08-08 17:28:09 阅读 我要评论

梁振英在礼拜二(12月10日)的答问大年夜会开端之际在其演说中报歉,但强调他在违章建筑问题膳绫腔有隐瞒的意图和念头。

Python 艺术二维码生成器

  1. pip install MyQR 
  2.  
  3. myqr https://github.com 
  4.  
  5. myqr https://github.com -v 10 -l Q 

假装浏览器身份

  1. pip install fake-useragent 
  2.  
  3. from fake_useragent import UserAgent 
  4.  
  5. ua = UserAgent() 
  6.  
  7.   
  8.  
  9. ua.ie 
  10.  
  11. # Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US); 
  12.  
  13. ua.msie 
  14.  
  15. # Mozilla/5.0 (compatible; MSIE 10.0; Macintosh; Intel Mac OS X 10_7_3; Trident/6.0)' 
  16.  
  17. ua['Internet Explorer'
  18.  
  19. # Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US) 
  20.  
  21. ua.opera 
  22.  
  23. # Opera/9.80 (X11; Linux i686; U; ru) Presto/2.8.131 Version/11.11 
  24.  
  25. ua.chrome 
  26.  
  27. # Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2'  

  1. python shell 
  2.  
  3. pip install sh 
  4.  
  5. from sh import ifconfig 
  6.  
  7. print ifconfig("eth0" 

处理中文文本内容

  1. pip install -U textblob#英文文本的情感分析 
  2.  
  3. pip install snownlp#中文文本的情感分析 
  4.  
  5. from snownlp import SnowNLP 
  6.  
  7. text = "I am happy today. I feel sad today." 
  8.  
  9. from textblob import TextBlob 
  10.  
  11. blob = TextBlob(text) 
  12.  
  13. TextBlob("I am happy today. I feel sad today."
  14.  
  15. blob.sentiment 
  16.  
  17. Sentiment(polarity=0.15000000000000002, subjectivity=1.0) 
  18.  
  19.   
  20.  
  21.   
  22.  
  23. s = SnowNLP(u'这个器械真心很赞'

      推荐阅读

      Windows 10 16257完美启用控制台新版配色的操作方法

    很多人在启用Windows10 16257控制台的新版配色时,发清楚明了一个小问题,那就是“大年夜Win+X菜单启动的Powershell和CMD标题栏上右击,选择“属性”,弹出窗口的色彩选项>>>详细阅读


    本文标题:那些有趣/用的Python库

    地址:http://www.17bianji.com/lsqh/36609.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)