Os Lstat
# Python2.x Python os.lstat() Method
[ Python OS File/Directory Methods](#)
* * *
### Overview
The os.lstat() method is used to return file information similar to stat(), but without symbolic links. On some platforms, this is an alias for fstat, such as Windows.
### Syntax
The syntax format of the **lstat()** method is as follows:
os.lstat(path)
### Parameters
* **path** -- The file to return information for.
### Return Value
Returns file information.
### Example
The following example demonstrates the use of the lstat() method:
#!/usr/bin/python# -*- coding: UTF-8 -*-import os, sys # open file path = "/var/www/html/foo.txt" fd = os.open( path, os.O_RDWR|os.O_CREAT )# close opened file os.close( fd )# Get tuple info = os.lstat(path)print "File information :", info # Get File UID Print "File UID :%d" % info.st_uid #
YouTip