1 # region Pretty-Print :)
2 def pprint_qa(self, qa):
3 """Pretty print a QA.
4 """
5 print '----------------------------------------'
6 movie = self.movies_map[qa.imdb_key]
7 print 'Movie: %s %s' % (movie.name, movie.year)
8 print 'Question: %s' % qa.question
9 print 'Options:'
10 for k, ans in enumerate(qa.answers):
11 if qa.correct_index == k:
12 print '***',
13 print '\t%s' % ans
14 print '----------------------------------------'
15
16
17 def pprint_movie(self, movie):
18 """Pretty print a Movie.
19 """
20 print '----------------------------------------'
21 print 'Movie: %s %s' % (movie.name, movie.year)
22 print 'Genre: %s' % movie.genre
23 print 'Available texts:'
24 for k, v in movie.text._asdict().iteritems():
25 print '%s: %s' % (k.rjust(12), v)
26 print '----------------------------------------'
27
28 # endregion
這些是把self.movies_map
, self.qa_list
裡面內容印在螢幕上。