Discover learning python fifth edition, include the articles, news, trends, analysis and practical advice about learning python fifth edition on alibabacloud.com
preservation.f.closed# If the file is closed, returns truef.encoding# viewing the encoding format of open files using the, note that not the actual encoding format of the fileF.tell #查看文件处理当前的光标位置F.seek (3) #从头开始运算, move the cursor to the third byteF.truncate #从头开始运算, files are kept only from 0-10 bytes of content, and the file must be opened in writing, except for ' W ' and ' w+ '.6 advanced application of the Seek methodSeek a total of 2 parameters, the first parameter is the number of cursor
follows:1nums=[1,2,3,4,5,6,2,3,4,6,4,3,2,1,2,3,4]2 Print(Nums[3:6])#[4,5,6]3 Print(Nums[:6])#[1,2,3,4,5,6] If the previous value of the slice is not written, the number from the beginning4 Print(nums[3:])#[4,5,6,2,3,4,6,4,3,2,1,2,3,4] If the subsequent value of the slice is not written, take the end5 Print(nums[:])#if the two values of a slice are not written, take it from the beginning to the end6 Print(Nums[::2])#step is 2, this represents all the elements, and then every 2 elements take a7 P
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.