SYS: the SYS. stdin, SYS. stdout, and SYS. stderrosos. name strings indicate the platform you are using. For example, for Windows, it is 'nt ', and for Linux/Unix users, it is 'posix '. The OS. getcwd () function obtains the current working directory, that is, the directory path of the current Python script. The OS. getenv () and OS. putenv () functions are used to read and set environment variables respectively. OS. listdir () returns all files and directory names in the specified directory. The OS. Remove () function is used to delete an object. The OS. System () function is used to run shell commands. The OS. linesep string specifies the row Terminator used by the current platform. For example, in windows, '\ r \ n' is used, in Linux,' \ n' is used, and in MAC, '\ R' is used '. The OS. Path. Split () function returns the directory name and file name of a path. >>> OS. path. split ('/home/swaroop/byte/code/poem.txt') ('/home/swaroop/byte/Code', 'poem.txt') OS. path. isfile () and OS. path. the isdir () function checks whether the given path is a file or a directory. Similarly, the OS. Path. exists () function is used to check whether the GIVEN PATH actually exists. OS. mkdir: Use Dir (OS) or Dir (sys) to view more
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