Author: vamei Source: http://www.cnblogs.com/vamei welcome reprint, please also keep this statement. Thank you!
1. Introduction to paths and files
See Linux File System
Http://www.cnblogs.com/vamei/archive/2012/09/09/2676792.html
2. OS. Path
Python standard library OS. path package, glob package use instance, OS. pathglob
OS. path package
The OS. path package is mainly used to process string paths, such as '/home/zikong/doc/file.doc' to extract useful information.
Copy codeThe Code is
This article mainly introduces the Python standard library OS. path package and glob package usage examples. This article provides the code directly. the code contains detailed comments. For more information, see
OS. path package
The OS. path
Os.path Bag
Os.path packages are primarily used to handle string paths, such as '/home/zikong/doc/file.doc ', to extract useful information.
Copy Code code as follows:
Import Os.path
Path = '/home/zikong/doc/file.doc '
Print
Urgent! The glob function is fine in the local window. if a problem occurs during the upload to linux, my program uses UTF-8 encoding, allowing users to register a Chinese user name and generate a file named in this Chinese language, such: member/162
What is Glob? Glob is the file name of the wildcard mechanism, so that document management is more convenient, concise, fast; When you manage files in the future, you can perform a one-time operation, which can quickly improve the work task!To
What is Glob? Glob is the file name of the wildcard mechanism, so that document management is more convenient, concise, fast; When you manage files in the future, you can perform a one-time operation, which can quickly improve the work task!To
The meaning of the offset parameter in the ##################### #read () function
Read (FILEHANBD, $var, $length, $offset)
The read function has four parameters, most easily misunderstood is the $offset
It means to look at the official document and
When it comes to wildcard characters, everyone will think very quickly about * and?Number, with wildcard characters, makes the expressive ability greatly enhanced, very many Linux commands support this thing, in fact is glob style pattern.Even the
first, batch and Shell
Directories and files:
The code is as follows:
C:\TESTFOLDER\TEST├─test2└─test3Test.txt
Delete the directory and all files under it:
The code is as follows:
RMDIR/S/q C:\TestFolder\test
Delete files from all directories,
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.