Python every day delicious (18)-linecache. Getline () read a specific row in the file

Source: Internet
Author: User
In python, The Getline method in linecache in the standard library can be used to read a specific row from a file. For example: Import Linecache
Print Linecache. Getline ( ' 2.1 _ open. py ' , 4 )

Will return to my previous exampleCodeThe output result is as follows:
F = open ('/home/Evergreen/desktop/test ')

View the implementation in linecache (I am using ulipad, So I directly move the cursor at linecache and press F6)


Linecache. py

 

Python daily delicious series (total)

Python daily delicious (16)-string filtering techniques, MAP and itertools. imap

Python every day (17)-open read/write files

Python every day delicious (18)-linecache. Getline () read a specific row in the file

Python daily delicious (19)-time processing datetime

Python daily delicious (20)-command line parameter SYS. argv

...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.