os.uname() AttributeError: 'module' object has no attribute 'uname'

os.uname()

Returns information identifying the current operating system. The return value is an object with five attributes:

  • sysname - operating system name
  • nodename - name of machine on network (implementation-defined)
  • release - operating system release
  • version - operating system version
  • machine - hardware identifier

For backwards compatibility, this object is also iterable, behaving like a five-tuple containing sysnamenodenamereleaseversion, and machine in that order.

Some systems truncate nodename to 8 characters or to the leading component; a better way to get the hostname is socket.gethostname() or even socket.gethostbyaddr(socket.gethostname()).

Availability: recent flavors of Unix. #只适用于类Unix 系统

Changed in version 3.3: Return type changed from a tuple to a tuple-like object with named attributes.

posted @ 2015-01-02 18:46  yumuxu  阅读(1182)  评论(0编辑  收藏  举报