I do not have time to help you right now. Please continue correspondence with the main tutor mailing list. ---------- Forwarded message ---------- From: "Андрей Пугачев" <pugachov.and...@gmail.com> Date: Feb 17, 2015 9:20 PM Subject: Re: [Tutor] Fwd: Need help with find error To: "Danny Yoo" <d...@hashcollision.org> Cc:
Hi, in this folder https://drive.google.com/folderview?id=0B5_iElL_NLhAfllsSDRlV20wR3JKd0ltdUt0UFNscklLWTAwS1k5b3pjbW9LNG1qNEhsZkE&usp=sharing you get 2 original files and folder "my" where is changed code. thanks for help 2015-02-17 22:29 GMT+02:00 Danny Yoo <d...@hashcollision.org>: > Forwarding to tutor. Again, apologies that I didn't respond earlier. > Overloaded. > > > ---------- Forwarded message ---------- > From: Андрей Пугачев <pugachov.and...@gmail.com> > Date: Tue, Feb 17, 2015 at 11:58 AM > Subject: Re: [Tutor] Need help with find error > To: Danny Yoo <d...@hashcollision.org> > > > Anybody can help with this? > > 2015-02-07 10:27 GMT+02:00 Андрей Пугачев <pugachov.and...@gmail.com>: > > > > Sorry for my absense, but you want to say, that loop in code isn't > working? (in main()-function) > > When category is empty code must print 2 last rows, but I have error.... > > > > I learn python book M. Dawson and this exercise from his book. > > I add original working files, where points count as score +=1 and all > works. > > But if I add some points to each question code don't work. > > I can't understand it/ > > > > > > > > 2015-02-04 20:24 GMT+02:00 Danny Yoo <d...@hashcollision.org>: > >> > >> As a revision of my initial question, when we look at next_block(), > >> it's documented as follows: > >> > >> ############################################ > >> def next_block(the_file): > >> """Return the next block of data from the trivia file.""" > >> .... > >> ############################################ > >> > >> What if there are no more blocks in the file? What should happen then? > >> > >> Let's say that we do a test, where we pass in the empty file to > next_block(). > >> > >> ###################### > >> from io import StringIO > >> x = next_block(StringIO('')) > >> ###################### > >> > >> What do you want to happen in this situation? > >> > >> --- > >> > >> As a side note: if you have control over the data format, you might > >> want to consider using JSON rather than a line-based format. If you > >> use JSON, this takes care of a few issues that you are working around > >> now. > >> > >> For example, you can reuse the newline escapes rather than define your > >> own convention. Also, rather than read a stream of records, where you > >> have to deal with the end of the file, you might just read one JSON > >> object that represents your whole trivia file, which will simplify > >> your program's logic. > >> > >> See: https://docs.python.org/2/library/json.html and use your favorite > >> web search engine for 'json python tutorial', and you should be able > >> to find some useful information. If you have questions, please feel > >> free to ask. > > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor