Python Program - Read last n lines of a file

Опубликовано: 04 Май 2019
на канале: HashTech Coders
1,035
11

In this video, I will show you a python script that will read the last n lines of a file wherein the number of lines will be specified by the user and also the file that is to be a pass for reading.

In this program, there needs to be space to distinguish between two lines if you pass a paragraph it won't work properly so take this into consideration it will work with content that is in rows and column format.

As we have seen in the last video we either pass the file name or the path of the file (i.e the location where the file is stored) so even here if your file and the python script are in the same folder you can just give the file name followed by the extension ("file.txt") or else if the file is stored in some other folder just pass the path ("E:/file.txt") and take care of the slash that you use we have to use forward slash while specifying the path.

Do Like Share and Subscribe.....

For more updates do follow us on:

Instagram:   / hashtech_coders  

Facebook:   / hashtechcoders  

Medium:   / hashtechcoders  

Thank you!!!


Смотрите видео Python Program - Read last n lines of a file онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь HashTech Coders 04 Май 2019, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 1,035 раз и оно понравилось 11 людям.