import requests
import json
import pprint #格式化输出模块
import pandas as pd
import prettytable as pt
from change import platformcode
from selenium_login import login
#登录
#预定地点火车显示系统
station_names = platformcode()
time1= input('请输入你预定时间如:2022-10-01(年-月-日)')
from_station = input('请输入列车起点站')
while from_station not in station_names.keys():
from_station = input('请输入列车起点站')
to_station = input('请输入列车终点站')
while to_station not in station_names.keys():
to_station = input('请输入列车终点站')
#获取信息
url='https://kyfw.12306.cn/otn/leftTicket/query'
params={
'leftTicketDTO.train_date':time1,
'leftTicketDTO.from_station':station_names.get(from_station),
'leftTicketDT