Ismar, the following don't look like Python lists to me. It's not clear which bits are supposed to be from the Python list, which bits are comments you have added. In your first example, it looks to me like one int (3628), followed by a list of longints, [36L, 317L], followed by perhaps a string "room type id" or maybe it's a comment you have added, followed by a list of room names, then a list of Decimals, another list of names, then a list of dates, again either with strings or comments inserted, and so on.
Please, in future, take the time to *clearly and accurately* describe the data format you are receiving. What you have given us is the worst of both words, neither pure Python nor a human-readable description of the data. So I'm forced to guess which bits are actually part of the data and which bits are not. [...] > 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. Sounds to me that you want us to do your work for you. We're here to teach you the Python programming language, not to do your programming work. How would you solve this problem by hand? I'm afraid that your description leaves me completely in the dark, I have no idea what you are talking about. If you don't know how to solve this problem by hand, we cannot help you -- we're not being paid to do your work for you. Once you have an algorithm to solve this problem, you can translate it into Python. If you have questions specific to the Python programming language, we'll help you with that. > my final result should be an xml file, that carries all the values in > this format : Python comes with various modules for writing XML: http://docs.python.org/2/library/markup.html Start by reading those pages, and decide which one is best suited for what you are trying to do. [...] > 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. How will we know how you need to relate these lists? It's your problem, not ours. We have no idea how to relate them. The first thing you should do is to split the list into the individual components so you can talk about them individually. For example, you might be able to do something like this: [hotelID, room_typeIDs, room_names, list_of_prices, season_names, list_of_dates, occupancies, occupancy_types] = master_list where "master_list" is the giant list you showed earlier, made up of many smaller lists and other fields. Now you can break the problem up into smaller problems. For example, how do you relate the number of room type IDs to the room names? What do you expect to do with the occupancy type information? How do you relate the number of prices with the list of dates? And so forth. You have to do this, not us, because we don't know anything about why you are doing this, what rules need to be applied, what result you expect. That's your job. Start with a simple example: how would you relate these dates: # ISO date format YYYY-MM-DD [2013-07-12, 2013-07-15, 2013-07-30, 2013-08-05] to these dates? [2013-07-14, 2013-07-19, 2012-09-10] Once you've broken the giant list-of-lists up into components, you can start to talk sensibly about what you want to do, e.g. what are the rules for relating the list of prices to the list of dates? -- Steven -----------------------------------------------###########----------------------------------------------- Steven,they are python lists, i just separated them for clarity, and they were all members of a huge tuple, as i described, psycopg2 query result.and the problem was unclear for me too, as i have very ignorant but ambitious bosses that like to patronize and criticize without obvious reasons..familiar? i'm well aware of python xml libraries, thank you.i was looking for an opinion, not a quick solution, and i solved my problem with zip(list1, list2) iteration, an idea i got here on this mailing list ...i'm a python beginner, not a professional.one day, when i'm a professional i will surely patiently help anyone that wants to learn.so, you want to say, that if i paid you, you would solve my problem?that's low.thx anyway-best regards. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor