本文整理汇总了Python中movie.Movie.read_movies_from_file方法的典型用法代码示例。如果您正苦于以下问题:Python Movie.read_movies_from_file方法的具体用法?Python Movie.read_movies_from_file怎么用?Python Movie.read_movies_from_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类movie.Movie
的用法示例。
在下文中一共展示了Movie.read_movies_from_file方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: find_movie
# 需要导入模块: from movie import Movie [as 别名]
# 或者: from movie.Movie import read_movies_from_file [as 别名]
def find_movie(self,user_action):
self.header_output("Finding....")
print "\n Example: find iron or find Iron Man 3 \n"
movies = Movie.read_movies_from_file()
if user_action != []:
arg = user_action.pop(0)
found = [x for x in movies if self.search(x,arg)]
self.movie_table_output(found)
示例2: list_movie
# 需要导入模块: from movie import Movie [as 别名]
# 或者: from movie.Movie import read_movies_from_file [as 别名]
def list_movie(self,kwargs):
print "\n Example: list name, list rating, list date or list by name etc. \n"
sort_order = 'name'
if kwargs != []:
if kwargs[0] == 'by':
sort_order = kwargs.pop(1)
else:
sort_order = kwargs.pop(0)
movies = Movie.read_movies_from_file()
if sort_order == 'date':
movies.sort(cmp = lambda x, y: cmp(x.date, y.date))
elif sort_order == 'rating':
movies.sort(cmp = lambda x, y: cmp(x.rating, y.rating))
else:
movies.sort(cmp = lambda x, y: cmp(x.movie, y.movie))
self.movie_table_output(movies)