def data_entry(categories):
# these are the values within categories
data_entry(['movies', 'sports', 'actors', 'tv', 'games', \
'activities', 'musicians', 'books'])
# for each different value in categories i need it to open a different txt file
# for example
when categories = movies ([0])
filename='movies.txt'
when categories = sports([1])
filename='sports.txt'
我该如何在代码中编写这个代码?对于python我想使列表中的每个值都对应另一个值
'file_names = dict((x,x +'.txt')for data_entry)'? – 2011-05-28 14:32:50