Python Library learning Notes (OS module)

Source: Internet
Author: User

OS.GETCWD (): View the current path .

Os.chdir (): changes The current working directory .

Os.listdir (): Lists all files in the directory and returns a list.

Os.path.split (): Breaks the path into (folder, file name).

Os.path.getmtime (PATH): The last modification time of a file or folder, from the new era to the number of seconds it was accessed.

Os.path.getatime (PATH): The last access time of a file or folder, from the new era to the number of seconds it was accessed.

Os.path.getctime (PATH): The time the file or folder was created , from the new era to the number of seconds it was accessed.

Os.path.getsize (PATH): Returns the size of the file or folder.

os.path.exists (path): Whether the file or folder exists , returns a Boolean value.

Os.path.isfile (PATH): Detects if it is a file and returns a Boolean value.

Os.path.isdir (PATH): Detects if it is a folder and returns a Boolean value.

Os.mkdir (): Create folder

Os.makedirs (): Recursively creating folders

Os.rmdir (): Delete Folder , only empty folders.

Os.removedirs (): Recursively delete empty folders .

Os.rename (name1,name2): File or folder rename. Change name1 to Name2

Os.name (): Returns the type of the operating system . #POSIX -Linux or Unix system,NT ->windows system.

Python Library learning Notes (OS module)

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.