×
Namespaces

Variants
Actions
Revision as of 01:29, 6 December 2008 by bogdan.galiceanu (Talk | contribs)

Archived:How to handle file metadata in PySymbian

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Nokia N95, Nokia E90
Compatibility
Platform(s): S60 1st Edition, S60 2nd Edition, S60 3rd Edition
Article
Keywords: os
Created: (17 Apr 2008)
Last edited: bogdan.galiceanu (06 Dec 2008)

Overview

This snippet shows how to read file metadata in Python.

Source code

import os, time
 
 
#Get the information for a file
statinfo = os.stat("C:\\Python\\ball.py")
 
#Display it
print "Size: " + str(statinfo.st_size)
print "Last modified: " + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime(statinfo.st_mtime))
print "Protection bits: " + str(statinfo.st_mode)
print "Inode number: " + str(statinfo.st_ino)
print "Device: " + str(statinfo.st_dev)
print "Number of hard links: " + str(statinfo.st_nlink)
print "User ID of owner: " + str(statinfo.st_uid)
print "Group ID of owner: " + str(statinfo.st_gid)

Postconditions

The information about the file is displayed.

74 page views in the last 30 days.
×