Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: what does "yield '\n'" do?
Post: RE: what does "yield '\n'" do?

(Jan-30-2018, 09:10 AM)Gribouillis Wrote: yield '\n' generates a string containing a single newline after all the lines have been generated. It is a way to ensure that there is a newline at the end ...
2sky General Coding Help 2 4,204 Jan-30-2018, 09:35 AM
    Thread: what does "yield '\n'" do?
Post: what does "yield '\n'" do?

I have seen this sample code from one python book: def lines(file): for line in file: yield line yield '\n' def blocks(file): block = [] for line in lines(file): if line....
2sky General Coding Help 2 4,204 Jan-30-2018, 09:05 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020