Git Product home page Git Product logo

tickets's Introduction

tickets

这是我在实验楼的 Python3 实现火车票查询工具 实验中写的代码

用的语言是Python2而不是原来的Python3,另外改进了一些功能并修补了一些漏洞

运行在 gbk 编码的命令行中,win10 的 cmd 亲测成功

##功能

在命令行中输入以下命令,即可返回相应的火车时刻表

tickets [-gdtkz] <from> <to> <date>

其中[-gdtkz]代表火车类型

效果如下图

最终效果

##用法

本项目需要用到第三方库,可通过以下命令安装

pip install urllib3 prettytable docopt colorama

推荐将本项目作为包安装进Python中,之后即可在命令行任意目录运行。步骤如下:

切换到本项目所在目录,运行命令

python setup.py install

然后你就可以在任意目录通过以下命令进行火车票查询了 :)

tickets [-gdtkz] <from> <to> <date>

如果不希望将本项目作为package安装,则可切到项目所在目录,通过以下命令运行

python tickets.py [-gdtkz] <from> <to> <date>

注意

本项目假定所有字符均为 gbk 输入 utf-8 输出,因此需运行在以 gbk 为默认编码的命令行中,且需设定显示的编码为 utf-8 ,对于windows系统,通过以下命令进行设置

chcp 65001

###关于本项目及对应课程的更多内容,可参见我的实验报告

tickets's People

Contributors

liuny05 avatar

Stargazers

Shortway avatar

Watchers

James Cloos avatar  avatar  avatar

tickets's Issues

代码有错误

代码有错误

返回结果判断

if not data['data']['flag']:
	print data['data']['message'].encode('utf-8')
	return
available_trains = data['data']['datas']

data['data']['flag']和data['data']['datas']是错误的,请问你是怎么跑通的?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.