Numbered list in python
问题 I need to make a numbered list from list elements in python. Example list: destinations = ['Los Angeles ', 'Rhodos ', 'Dubai ', 'Manila ', 'Mallorca ', 'New York '] I need to print out elements as numbered list: 1. Los Angeles 2. Rhodos 3. Dubai 4. Manila 5. Mallorca 6. New York If I do: print ('\n'.join(destinations)) It prints out elements on separate lines, but I cannot add numbers. 回答1: You simply use enumerate() and count from 1 >>> destinations = ['Los Angeles ', 'Rhodos ', 'Dubai ',