當前位置: 首頁>>代碼示例>>Python>>正文


Python Movie.read_movies_from_file方法代碼示例

本文整理匯總了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)
開發者ID:salmanhoque,項目名稱:MovieApp_python,代碼行數:10,代碼來源:interface.py

示例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)
開發者ID:salmanhoque,項目名稱:MovieApp_python,代碼行數:19,代碼來源:interface.py


注:本文中的movie.Movie.read_movies_from_file方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。