Recently I saw the use of Python to realize the train ticket query, I also realized, feel a lot of harvest, below I will each step of the detailed to share out. (Note that the Python3 is used)
First I show the final result:
Execute at cmd command line: Python tickets.py-dk Shanghai Chengdu 20161007 > Result.txt
Check the
Forwarding is the largest support for small series
This article goes from the network
2017 years of time flies, blink of an eye in the 2018 Spring Festival in less than two months, people away from home have to buy home tickets to the matter put on the agenda. Recently, China's traffic news released the "2018 Spring Festival Big Data," the data show that the 2018-year Spring Festival passengers are expected to break through 3 billion people, a year earlier growth....Unimaginable data,It
:
Run in cmd: Python parse_stations.py > stations.py
will be in the current directory to get the stations.py file, the file is the site name and abbreviation, in the stations.py file added "stations =" This is a dictionary, convenient to the back of the value, the following is the contents of the stations.py file:
3.2 Now get the train information parameters are ready to be, the next is to get the return v
--------Blogs: Chen http://www.cnblogs.com/chenyuebai -------- I. OverviewWhen she works, she needs to inquire a lot of information about trains to Nanjing , including the arrival station ( Nanjing Station or Nanjing South Railway station), arrival time, departure time and so on, then make the next work according to these information.Version of the end, take advantage of the intermittent period, help her to get a simple batch query tool, the pink button is for her to use ~ haha ha! (?*?*?)About
has been obtained, and the rest is to extract the information we need and display it.prettytableThis database allows us to format and display data like the MySQL database.
$ pip3 install prettytable
Use it like this:
...From prettytable import PrettyTableDef cli ():... headers = 'train station time lasted business first class second class soft sleeper hard sleeper soft seat no seat '. split () pt = PrettyT
There is no use of Python for some time, a few days ago, a friend brought up a piece about the use of Python to rob the train ticket article, Baidu to achieve the technical details of the train ticket, online but there is a lot of information, is not fresh things. In the understanding of some technical means, read some
Preface: Everybody read with me,python Dafa Good, follow this baby to rob the train ticket with pythonFirst, we need splinter .Installation:pip Install splinter - I. http://pypi.douban.com/simple --trusted-host pypi.douban.comThen you need a browser driver, of course, with Chrome .:http://chromedriver.storage.googleapis.com/index.html?path=2.20/According to the download of your own computer system select
Preface: Everybody read with me, Python dafa good, follow this baby to rob the train ticket with Python
First, we need splinter.
Installation:
Pip install splinter-i http://pypi.douban.com/simple--trusted-host pypi.douban.com
Then you need a browser driver, of course, with chrome.
Download Address:
http://chromedriver.storage.googleapis.com/index.html?path=2.20
This article has sorted out some of the more useful on the Python split file method, the method is very simple and practical. Share to everyone for your reference. Specifically as follows:
Example 1 specifies the split file size
Configuration file Config.ini:
Copy Code code as follows:
[Global]
#原文件存放目录
Dir1=f:\work\
Cut method in stuttering participle to "what's your Name" word breaker print (Cut_word) # cut_word_list = List (Cut_word) # If you don't understand the generator, remember to make the Generator object list print (cut_word_list) # [' You ', ' call ', ' What ', ' name '] The test code is very obvious, it is very clear to the Chinese string into a list of the store upThe second one is a language training library called Gensim.Pip Install G
Two days ago a friend said, want to implement a text file according to a fixed number of lines to split into multiple text files, but do not know how to achieve. If the amount of data is small manual segmentation is good, if the volume of data is very large, manual completion is too labor-intensive, also unrealistic. Then you need to use scripts to implement them. Since a friend wants to accomplish this task simply, it is better to record it and make
') #以 ' \ n ' as a separator, as many times as possible[' Love ', ' hello ', ' python ']>>> Print SLoveHelloPython
Practice the following example:
>>> s= ' Hello Python>>> s.split (' [') [1].split ('] ') [0]' Www.python.com '>>> s.split (' [') [1].split ('] ') [0].split ('.
Python string replacement requires constant learning. Only continuous learning can be used better. Next, let's take a look at how to replace the Python string in actual use. This will help you in future use.
Python string replacement
Replace all matched substrings. Replace all substrings in the subject that match the regular expression regex with newstring
R
Two days ago a friend said, want to implement a text file according to a fixed number of lines to split into multiple text files, but do not know how to achieve. If the amount of data is small manual segmentation is good, if the volume of data is very large, manual completion is too labor-intensive, also unrealistic. Then you need to use scripts to implement them. Since a friend wants to accomplish this task simply, it is better to record it and make
7932194664399081925240327364085538615262247266704805319112350403608059673360298012239441732324184842421613954281007791383 5662483234649081399066056773207629241295093892203457731833496615835504729594205476898112116936771475484788669625013844382 6029173234888531116082853841658502825560466622483189091880184706822220314052102669843548873295802887805086973618690071472 0710555703168729087
LimitEach test point 1sTipsIt's very simple, don't think it's c
is only two or more than two people of the meaning of transmission. () the control span of the flat type organization is smaller. () The quality of the enterprise is generally high, the intention of the leadership can be well understood, it is appropriate to take centralized management. the key to decision-making is the goal, and there is no decision without a goal. () brainstorming is developed to ensure the creativity of group decision-making, improve decision-making quality
. if you understand this line, I will add additional points .. MultipleLearn more about all aspects of testing. python is just a tool. The theoretical knowledge of testing is very important.Is it recommended to use python for automated software testing?
Although python contains packages such as testsuite. However, automated testing is not related to programming.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.