#I assume the data is in 'text' as a string.
data = text.split()
Movie, Year, oscars, nominations = ''.join(data[:-3]), data[-3], data[-2], data[-1]
因此,考虑到数据在列表中,可以将其加载到for循环中:
# list_of_lines is a list where each item is a line of data
whole_data = list()
for text in line_of_lines:
data = text.split()
whole_data.append({'title':''.join(data[:-3]), 'year': data[-3], 'oscars': data[-2], 'nominations': data[-1]})
# Do something with your info
我来试试这个:
因此,考虑到数据在列表中,可以将其加载到for循环中:
你可以试着用python的字典。你知道吗
http://www.tutorialspoint.com/python/python_dictionary.htm
并访问它们:
您可以简单地将电影条目拆分为以下四个字段:
相关问题 更多 >
编程相关推荐