
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 10441 Articles for Python

7K+ Views
Regular expressions, or regex, are useful in Python when you need to find patterns in text. If you want to perform verification for a string that contains a date, in this case regex is useful. In this article, we will learn simple ways to match date strings using Python regex in the coming sections. Dates can come in many formats, like - YYYY-MM-DD YYYY/MM/DD YYYY.MM.DD YYYYMMDD DD-MM-YYYY DD/MM/YYYY Regular expression helps us find these patterns easily, so we can validate or extract dates from the given text. There are several ways to match a date string ... Read More

6K+ Views
This article will discuss what raw string notation is in Python regular expressions. Regex is a set of characters that specifies a search pattern and is mostly used in text processors and search engines to execute find and replace operations.In Python, regular expressions are used to find patterns in text. But some characters (like and \t) may create problems. Raw string notation (r'') can be useful here! This allows Python to treat backslashes as normal characters, which makes regex patterns easy to create and interpret. Python uses "" to escape characters in raw strings. This can change your regex pattern, ... Read More

15K+ Views
There are various ways to get the file creation and modification datetime in Python. We will use different methods from the OS and pathlib module to get the file creation and modification datetime in Python. Using OS Module: File Creation Time On Windows Using OS Module: File Modification Time On Windows ... Read More

9K+ Views
In this article, we convert a date string to a date object. We will use the strptime() method to convert a date string to a date object, and we will also use the dateutil module for flexible date parsing. A date string is a date written in text form, like "09 May 2025" or "2025-05-09". To work with dates in Python, we will have to convert these strings into date objects. To achieve this, we can use Python's datetime and dateutil modules. Using the strptime() Function The strptime() method takes the date as input and converts it into a ... Read More

112K+ Views
This article will discuss how to format date and time in Python. Python makes it easy to work with date and time with the help of the datetime module. You can format dates and times in different formats as per your needs. Datetime Module of Python The datetime module in Python offers methods for working with date and time values. To use this module, we must first import it using the following import keyword- import datetime Strftime() Function The strftime() function returns a formatted date and time. It accepts a format string that you can use to get the ... Read More

1K+ Views
In this article, we will show you how you can get the current time and date in Python with the help of different functions. Here are the different ways to get the current Date and Time using the Datetime Module - Using the now() Method Using the today() Method Current ... Read More

203 Views
In this article we will show you how you can print complete TimeTuple in Python. So printing a complete timeTuple in Python is very useful when you want to extract various parts of a date. For example you can use it to get the year, month, day, hour, minute, second and microsecond from a date. The time tuple is a tuple of 9 integers like year, month, day, hour, minute, second and microsecond. The first 6 items are required and the last 3 are optional basically. Here are different ways to do this task and print a time tuple - ... Read More

2K+ Views
In this article, we will show you how you can get the timer ticks at the given time using different functions in Python. To get the timer ticks at the given time, there is a time module available in Python. Here is the list of ways to solve this problem - Using time.time() Function Using time.perf_counter() Function Using time.process_time() Function Let us discuss each of these methods one by one in the section below - Using time.time() Function The time.time() function is used to get the current time in seconds. It returns the number of seconds since the ... Read More

2K+ Views
In Python, a tick is the floating-point number to show time in seconds since January 1, 1970. This is mainly used in time calculations and logging timestamps in programs. Python's time module givens the function time.time() to fetch the current tick value. It is very useful for measuring execution tracks time in seconds. Also it helps in scheduling tasks with timestamps. Using Tick in Python The time.time() function from the time module gets the current tick value. This value increases as time moves forward. This method does not accept any parameters, as it always returns the current UTC time. ... Read More

24K+ Views
In this article, we will discuss how to extract a list of all the values from a Python dictionary. Following are various ways to retrieve list of all the values from a Python dictionary - Using dict.values() & list() Functions Using [] and * Using List comprehension ... Read More