![]() |
| ||
| File Modification Time Does Python have a module to display when a file has been last modified? Also, how do you get the file length? |
| ||
| Re: File Modification Time The functions are contained in module os. Function os.path.getmtime() gives you the last modified time in seconds since the beginning of 1/1/1970 (epoch). You have to do some formatting with module time functions to make it readable for the ordinary mortal. The size of the file is returned by os.path.getsize() in bytes, convert to kilobytes and format the result. import osSimilarly function os.path.getatime() gives the last access time. |
| ||
| Re: File Modification Time A kbyte is 1024 bytes. This would be more correct: fsize = os.path.getsize(fname) |
| All times are GMT -4. The time now is 2:12 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC