Python obtains operating system information

Source: Internet
Author: User

There is a platform module in Python to obtain information about the operating system.
Import platform
Platform. machine () # Returns the machine type, e.g. 'i386'

Platform. node () # Returns the computer's network name

Platform. platform (aliased = 0, terse = 0) # Returns a single string identifying the underlying platform

Platform. processor () # Returns the (true) processor name

Platform. python_branch () # Returns a string identifying the Python implementation branch.

Platform. python_build () # Returns a tuple (buildno, builddate) stating the Python build number and date as strings.

Platform. python_compiler () # Returns a string identifying the compiler used for compiling Python.

Platform. python_version () # Returns the Python version as string 'major. minor. patchlevel'

Platform. release () # Returns the system's release, e.g. '2. 2.0 'or 'nt'

Platform. system () # Returns the system/OS name, e.g. 'linux ', 'windows' or 'java '.

Platform. uname () # Fairly portable uname interface. Returns a tuple of strings (system, node, release, version, machine, processor) identifying the underlying platform.

Platform. win32_ver (release = '', version ='', csd = '', ptype ='') # Get additional version information from the Windows Registry and return a tuple (version, csd, ptype) referring to version number, CSD level and OS type (multi/single processor ).

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.