예제 #1
0
 elif op2 == 4:
     try:
         print('有三种路径可供查询:')
         print('1.花费最少')
         print('2.时间最短')
         print('3.换乘最少')
         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 = []