hello, good people. i have a pretty urgent question.the situation is like this, i have following lists, as results of numerous psycopg2 queries, here are two examples : for one hotel, id 3628 :
3628 [36L, 317L] - room type id ['DBP', 'DS5'] - room names [Decimal('10.00'), Decimal('17.00'), Decimal('15.00'), Decimal('20.00'), Decimal('22.00'), Decimal('19.00'), Decimal('23.00'), Decimal('30.00'), Decimal('25.40'), Decimal('33.50'), Decimal('40.50')] - all available prices ['LOW', 'MID', 'HIGH'] - season names [datetime.date(2014, 5, 1), datetime.date(2014, 6, 21), datetime.date(2014, 7, 16), datetime.date(2014, 8, 21), datetime.date(2014, 9, 13)] - season start datetimes, | [datetime.date(2014, 6, 20), datetime.date(2014, 7, 15), datetime.date(2014, 8, 20), datetime.date(2014, 9, 12), datetime.date(2014, 9, 30)] -season end datetimes | -------> the two datetimes lists correspond to each other in such a manner that first datetime from season starts shoud be in pair with first datetime in season ends [0, 1, 2, 3] - ---> these are numbers of persons per occupancy ['BB', 'HB'] ---> these are occupancy types (bed and breakfast, half board) second hotel id, 3588, second lists: 3588 [52L, 302L, 303L, 108L, 106L, 316L, 319L, 188L, 37L, 240L] ['AP2', 'DB3', 'DB4', 'DBO', 'DBS', 'DS4', 'DS7', 'FAM', 'SNG', 'ST2'] [Decimal('30.00'), Decimal('33.00'), Decimal('20.00'), Decimal('45.00'), Decimal('48.00'), Decimal('58.00'), Decimal('61.00'), Decimal('72.00'), Decimal('76.00'), Decimal('29.00'), Decimal('40.00'), Decimal('43.00'), Decimal('54.00'), Decimal('57.00'), Decimal('65.00'), Decimal('69.00'), Decimal('37.00'), Decimal('39.00'), Decimal('56.00'), Decimal('60.00'), Decimal('87.00'), Decimal('91.00'), Decimal('127.00'), Decimal('135.00'), Decimal('31.00'), Decimal('41.50'), Decimal('44.00'), Decimal('66.00'), Decimal('70.00'), Decimal('32.00'), Decimal('47.00'), Decimal('74.00'), Decimal('41.00'), Decimal('93.00'), Decimal('98.00'), Decimal('138.00'), Decimal('144.00'), Decimal('137.00'), Decimal('34.00'), Decimal('35.00'), Decimal('49.00'), Decimal('50.00'), Decimal('62.00'), Decimal('64.00'), Decimal('78.00'), Decimal('42.00'), Decimal('55.00'), Decimal('68.00')] ['LOW', 'MID 1', 'MID 2', 'HIGH'] [datetime.date(2014, 4, 17), datetime.date(2014, 5, 1), datetime.date(2014, 5, 21), datetime.date(2014, 5, 23), datetime.date(2014, 6, 11), datetime.date(2014, 6, 13), datetime.date(2014, 7, 4), datetime.date(2014, 7, 9), datetime.date(2014, 8, 27), datetime.date(2014, 8, 30), datetime.date(2014, 9, 10), datetime.date(2014, 9, 12), datetime.date(2014, 9, 26)] [datetime.date(2014, 5, 22), datetime.date(2014, 5, 20), datetime.date(2014, 6, 10), datetime.date(2014, 6, 12), datetime.date(2014, 7, 8), datetime.date(2014, 7, 3), datetime.date(2014, 8, 29), datetime.date(2014, 8, 26), datetime.date(2014, 9, 9), datetime.date(2014, 9, 11), datetime.date(2014, 9, 30), datetime.date(2014, 9, 25), datetime.date(2014, 10, 15)] [1, 2, 3, 4, 0] ['AI'] the point is, i need to make relations between lists in one hotel id range, so prices are arranged by every season start and end dates, so one price, two datetimes, also i need to take in consideration - i only need prices which have equal differences between seasons, and use them further in my code, while prices that do not match that equation are used with list that carries the number of occupancies, and also shoud be used further in my calculations.seasons names list is there to give me a clue how to arrange the dates. my final result should be an xml file, that carries all the values in this format : for hotel id 3628, notice that the difference between the prices is 7, that's what i mean when i say i have to take the prices that have equal difference per seasons. <Supplements> <Supplement> <Board Code="BB" Start="2014-05-01" End="2014-09-30"> <Adults> <Adult MinAge="" MaxAge="" Price="0" PersonPosition=""> <!--PersonPosition only used if price per adult number is set--> </Adult> </Adults> <Children> <Child MinAge="2" MaxAge="11" Price="0" PersonPosition="" /> </Children> </Board> </Supplement> <Supplement> <Board Code="HB" Start="2014-05-01" End="2014-09-30"> <Adults> <Adult MinAge="" MaxAge="" Price="7" PersonPosition=""> <!--PersonPosition only used if price per adult number is set--> </Adult> </Adults> <Children> <Child MinAge="2" MaxAge="11" Price="3,5" PersonPosition="" /> </Children> the lists above are just for adult prices, i have to do the same thing for children, once i get this done. so please, i need some pointers in how to get these lists related, regarding i cannot use indexing, because i don't always have the same number of items in list. thanks for any of your help.i'm still a beginner, would be great to learn new tricks about lists. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor