英国铁路行业使用的收集铁路代码的小型刮网机

pyrcs的Python项目详细描述


pyrcs

作者:钱富Twitter URL

PyPIPyPI - Python VersionGitHubGitHub code size in bytesPyPI - DownloadsWebsite

一种小型的网络刮板,用于收集英国铁路行业使用的铁路代码和其他数据。

安装

pip install --upgrade pyrcs

注释

  • 确保安装了最新版本的pip

    python -m pip install --upgrade pip
    
  • Python-Levenshtein,此软件包的依赖项之一,可能无法安装在没有VC2015(或更高版本)的Windows操作系统上。解决方法是下载并安装其.whl文件。在这种情况下,如果在64位操作系统上使用python 3.7,则应该选择python_Levenshtein-0.12.0-cp37-cp37m-win_amd64.whl

    pip install --upgrade \path\to\python_Levenshtein-0.12.0-cp37-cp37m-win_amd64.whl
    

快速入门(示例)

The following examples may provide a quick guide to the usage of the package.

1. CRS, NLC, TIPLOC and STANOX Codes

If your preferred import style is ^{}:

^{pr 4}$

If your preferred import style is ^{}:

^{pr 5}$

After importing the module, you can create a 'class' for the location codes (including all CRS, NLC, TIPLOC, STANME and STANOX) :

^{pr 6}$

Given different preferences, there are several alternative ways of importing the module.

Alternative 1:

^{pr 7}$

Alternative 2 (Preferred and used for the following examples):

^{pr 8}$

1.1 Locations beginning with a given letter

You can get the location codes starting with a specific letter, say 'A' or 'a', by using the method^{}, which returns a ^{}.

^{pr 9}$

The keys of ^{} include:

  • ^{}
  • ^{}
  • ^{}

The corresponding values are:

1.2此类别中所有可用的位置代码

You can also get all available location codes in this category as a whole , using the method ^{}, which also returns a ^{}:

^{pr 10}$

The keys of ^{} include:

  • ^{}
  • ^{}
  • ^{}
  • ^{}

The corresponding values are:

2.工程师线路参考(ELR)

^{pr 11}$

2.1 ELR codes

To get ELR codes starting with a specific letter, say ^{}, by using the method ^{}, which returns a ^{}.

^{pr 12}$

The keys of ^{} include:

  • ^{}
  • ^{}

The corresponding values are:

要获取所有可用的elr代码,请使用方法fetch_elr,该方法返回dict

elr_codes=em.fetch_elr()

elr_codes的键包括:

  • 'ELRs_mileages'
  • 'Latest_updated_date'

相应的值为:

  • elr_codes['ELRs_mileages']是包含所有表数据(从'a'到'z')
  • elr_codes['Latest_updated_date']是所有初始特定表数据中最新的“最后更新日期”(instr

2.2里程文件

To collect more detailed mileage data for a given ELR, say ^{}, by using the method ^{}, which returns a ^{}:

^{pr 14}$

The keys of ^{} include:

  • ^{}
  • ^{}
  • ^{}
  • ^{}

The corresponding values are:

  • ^{} is the name (in ^{}) of the given ELR
  • ^{} is associated line name (in ^{})
  • ^{} is associated sub line name (in ^{}), if available
  • ^{} is a ^{} of the mileage file data

3. Railway stations data

The data of railway stations belongs to another category, 'Other assets'

frompyrcs.other_assetsimportOtherAssetsother_assets_cls=OtherAssets()

与获取上述“CRS、NLC、TIPLOC和STANOX代码”类似,通过给定的首字母(例如“A”)获取站点数据:

stations_a=other_assets_cls.Stations.collect_station_locations('A')

要获取所有可用的电台数据:

stations=other_assets_cls.Stations.fetch_station_locations()

stations_astations的数据类型都是dict

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java我想访问同一类的不同函数中的函数变量   创建字段/值哈希映射的java反射   java Velocity工具向后兼容性?   cmd JAVA运行时错误:发生JNI错误   java spring引导示例hateoas不工作   java为什么Android Studio和gradle可以使用不同的类路径进行单元测试?   java Selenium Firefox驱动程序初始化   java如何在jar中重新定位gradle依赖项的包   java为什么我的单线程hello world应用程序使用22个OS线程?   正则表达式替换Java字符串中的特殊字符   在任何派生类的构造函数之后运行方法的java   java从输入字符串中找出日期   带有libGdx(Java)音乐的安卓studio可以在Android模拟器上工作,但不能在桌面上工作   java我在getconnection的参数方面有错误吗?   java使用JFileChooser访问选定文件   java如何将Json解析为另一个活动   java使用Resources for html和rest server   java更新列表,列表内容来自循环中的方法   java如何在GLSL中读取完整范围的32位整数纹理