我需要从 python 中的列表元素制作一个编号列表。示例列表:
destinations = ['Los Angeles ', 'Rhodos ', 'Dubai ', 'Manila ', 'Mallorca ', 'New York ']
我需要将元素打印为编号列表:
1. Los Angeles
2. Rhodos
3. Dubai
4. Manila
5. Mallorca
6. New York
如果我做:
print ('\n'.join(destinations))
它在单独的行上打印出元素,但我不能添加数字。