Richard Trump

How To Get The Current Date Time In Python

1. How to get the current system date time in python. Import the python datetime module. >>> import datetime Get the current date time. >>> curr_time = datetime.datetime.now() >>> >>> curr_time.year 2021 >>> curr_time.month 4 >>> curr_time.day 5 >>> curr_time.hour 19 >>> curr_time.minute 54 >>> curr_time.second 22 >>> curr_time.date() datetime.date(2021, 4, 5) 2. How to …

How To Get The Current Date Time In Python Read More »

How To Create A Folder With Python

This article will show you some examples of how to use the python os.path module exists function to check file/folder existence. And how to create directory and subdirectory with python os module mkdir and makedirs function.

How To Sort Lists In Python

Python provides two sorting methods for a list object, one is to use the built-in function sort of the list object, the other is to use the sorted function to sort. The difference between the two sort methods is that the sorted function does not change the original list and returns a sorted list.