作家
登录

那些有趣/用的Python库

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

 
  •  
  • 541 847(马甸桥西-雷庄村) 
  •  
  • >>> line.stations 
  •  
  • [<Station 马甸桥西>, <Station 马甸桥东>, <Station 安华桥西>, ...] 
  •  
  • >>> station = line.stations[0] 
  •  
  • >>> print station.name, station.lat, station.lon 
  •  
  • 马甸桥西 39.967721 116.372921 
  •  
  • >>> line.get_realtime_data(1) # 参数为站点的序号,大年夜1开端 
  •  
  •  
  •     { 
  •  
  •         'id': 公交车id, 
  •  
  •         'lat': 公交车的地位, 
  •  
  •         'lon': 公交车地位, 
  •  
  •         'next_station_name': 下一站的名字, 
  •  
  •         'next_station_num': 下一站的序号, 
  •  
  •         'next_station_distance': 离下一站的距离, 
  •  
  •         'next_station_arriving_time': 估计达到下一站的时光, 
  •  
  •         'station_distance': 离本站的距离, 
  •  
  •         'station_arriving_time': 估计达到本站的时光, 
  •  
  •     }, 
  •  
  •     ... 
  •  
  •  
  • 文┞仿提取器

    1. git clone https://github.com/grangier/python-goose.git 
    2.  
    3. cd python-goose 
    4.  
    5. pip install -r requirements.txt 
    6.  
    7. python setup.py install 
    8.  
    9.   
    10.  
    11. >>> from goose import Goose 
    12.  
    13. >>> from goose.text import StopWordsChinese 
    14.  
    15. >>> url  = 'http://www.bbc.co.uk/zhongwen/simp/chinese_news/2012/12/121210_hongkong_politics.shtml' 
    16.  
    17. >>> g = Goose({'stopwords_class': StopWordsChinese}) 
    18.  
    19. >>> article = g.extract(url=url) 
    20.  
    21. >>> print article.cleaned_text[:150]  

    火车余票萌芽

    喷鼻港行政长官梁振英在各方压力下就其大年夜宅的违章建筑(僭建)问题到立法会接收质询,并向喷鼻港平易近众报歉。


      推荐阅读

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

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


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

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

    关键词: 探索发现

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

    网友点评
    自媒体专栏

    评论

    热度

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