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