예제 #1
0
         m = int(input('请输入您要查询的路径种类的序号:'))
         if m not in {1,2,3}:
             print('请输入合法的序号!')
             continue
         end_pos = str(input('请输入您的目的地:'))
         if end_pos not in all.spots:
             print('请输入合法的景点名称!')
             continue
         if m == 1:
             all.get_costshortest(start_pos,end_pos)
             sit = int(input('结束请输入0,继续请输入任意整数:'))
         elif m == 2:
             all.get_timeshortest(start_pos, end_pos)
             sit = int(input('结束请输入0,继续请输入任意整数:'))
         else:
             all.get_transhortest(start_pos, end_pos)
             sit = int(input('结束请输入0,继续请输入任意整数:'))
     except:
         print('请输入合法的景点名称!')
         sit = int(input('结束请输入0,继续请输入任意整数:'))
 else:
     try:
         print('多目的地旅游线路查询。')
         m = '1'
         appr = []
         while True:
             m = str(input('请分别输入您要前往的目的地(输入一个按一下回车),若已全部输入完毕,请直接按回车:'))
             if m == '':
                 break
             else:
                 if m in all.spots and m not in appr: