print e.message break except ticketConfigException as e: print e.message break except ticketIsExitsException as e: print e.message break except ticketNumOutException as e: print e.message break except UserPasswordException as e: print e.message break except ValueError as e: if e.message == "No JSON object could be decoded": print(u"12306接口无响应,正在重试") else: print(e.message) except KeyError as e: print(e.message) except TypeError as e: print(u"12306接口无响应,正在重试 {0}".format(e.message)) except socket.error as e: print(e.message) if __name__ == '__main__': login() # a = select('上海', '北京') # a.main()
num, self.station_date, ",".join(self.station_trains), (datetime.datetime.now() - start_time).microseconds / 1000) except PassengerUserException as e: print e.message break except ticketConfigException as e: print e.message break except ticketIsExitsException as e: print e.message break except ticketNumOutException as e: print e.message break except ValueError as e: if e.message == "No JSON object could be decoded": print("12306接口无响应,正在重试") else: print(e.message) except KeyError as e: print(e.message) except TypeError as e: print(e.message) except socket.error as e: print(e.message) if __name__ == '__main__': login() # a = select('上海', '北京') # a.main()
__author__ = 'Sylvanus' import pre import init import search import recommend pre.prepare() (hashtable, similarity) = init.loadData() scores = init.login(2297) text = ['小说', '十字'] booklist = search.doSearch(text, hashtable) print('list: ', booklist) recommender = recommend.recommend(booklist, similarity, scores) print('recommender: ', recommender)