Python: Sort File Line by Line


Video is ready, Click Here to View ×

To sort the lines of a file we first open the file, read each line into a list, sort the list, then write the sorted list to another file. This video shows you how to write the code.

8 thoughts on “Python: Sort File Line by Line

  1. how can i read a .txt file with a list like:

    i need reed this file .txt from another file but read first the line1,then the line2,then the line 3 etc and when the last line come brake automatically

  2. vedio is good… but I was thinking … is there any alternative method… Your mentioned method is good but if file is huge then probably It will take long time to complete task…

Leave a Reply

Your email address will not be published. Required fields are marked *