Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

check how many days old file is python

>>> import datetime
>>> today = datetime.datetime.today()
>>> modified_date = datetime.datetime.fromtimestamp(os.path.getmtime('yourfile'))
>>> duration = today - modified_date
>>> duration.days > 90 # approximation again. there is no direct support for months.
True
Comment

PREVIOUS NEXT
Code Example
Python :: generate a random np image array with shape 
Python :: find out length of a string in pixels python 
Python :: python oneline if statement 
Python :: binary search iterative 
Python :: python __add__ 
Python :: triplets in python 
Python :: list object attributes python 
Python :: how to add column to heroku postgres in my django app 
Python :: python manually trigger exception 
Python :: change state enabled tkinter 
Python :: use rclone on colab 
Python :: run a shell script from python 
Python :: retrieve content inside the meta tag python 
Python :: Plot kdeplot, lineplot, scatterplot in seaborn 
Python :: # add keys to existing dictionary 
Python :: python find cells with na 
Python :: how to use with statement in python 2.5 and earlier 
Python :: python global lists 
Python :: how to format a file in python 
Python :: scapy get packet source ip address python 
Python :: python select from list by boolean list 
Python :: get diagonals of 2d array 
Python :: encrypt and decrypt sha256 python 
Python :: how draw shell in python 
Python :: how to install pywhatkit in pycharm 
Python :: ski learn decision tree 
Python :: lambda example python 
Python :: pandas get highest values column 
Python :: create a list of pandas index 
Python :: python greater than dunder 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =