
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
Rajendra Dharmkar has Published 345 Articles

Rajendra Dharmkar
512 Views
Organizing Python modules efficiently is important to maintain scalability and collaboration. Following best practices can make your project easier to understand and use. In this article, we will discuss about an structure approach to organize Python modules with a sample project and some of the best practices to organize. Sample ... Read More

Rajendra Dharmkar
96K+ Views
The task or process of importing other files in Python allows you to use functions, classes, or variables defined in those files within your current Python script. In this article, we will explore different ways to import other Python files, including built-in modules, user-defined modules, and importing specific functions or ... Read More

Rajendra Dharmkar
4K+ Views
Whenever you want to add or subtract(apply an offset) to a date/time, use a datetime.datetime(), then add or subtract datetime.timedelta() instances. A timedelta object represents a duration, the difference between two dates or times. The timedelta constructor has the following function signature − datetime.timedelta([days[, seconds[, microseconds[, milliseconds[, minutes[, hours[, weeks]]]]]]]) ... Read More

Rajendra Dharmkar
7K+ Views
According to Python documentationPython does not currently have an equivalent to scanf(). Regular expressions are generally more powerful, though also more verbose, than scanf() format strings. The table below offers some more-or-less equivalent mappings between scanf() format tokens and regular expressions.scanf() TokenRegular Expression%c.%5c.{5}%d[-+]?\d+%e, %E, %f, %g[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?%i[-+]?(0[xX][\dA-Fa-f]+|0[0-7]*|\d+)%o[-+]?[0-7]+%s\S+%u\d+%x, %X[-+]?(0[xX])?[\dA-Fa-f]+To extract the filename and ... Read More

Rajendra Dharmkar
5K+ Views
The following code uses a regular expression '(a|b)' to match a or b in the given Python string.We are also using the flag re.I to ignore case of a or b while matching. Example import re s = 'Bank of Baroda' print(re.findall(r'(a|b)', s, re.I))OutputThis gives the output['B', 'a', 'B', ... Read More

Rajendra Dharmkar
11K+ Views
You can subtract a day from a Python date using the timedelta object. You need to create a timedelta object with the amount of time you want to subtract. Then subtract it from the date. Example from datetime import datetime from datetime import timedelta today = datetime.today() yesterday = today ... Read More

Rajendra Dharmkar
5K+ Views
You can use the fromtimestamp() function from the datetime module to get a date from a UNIX timestamp. This function takes the timestamp as input and returns the datetime object corresponding to the timestamp. Exmaple import datetime timestamp = datetime.datetime.fromtimestamp(1500000000) print(timestamp.strftime('%Y-%m-%d %H:%M:%S'))OutputThis will give the output −2017-07-14 08:10:00Read More

Rajendra Dharmkar
10K+ Views
The following code demonstrates the use of variables in Python regex.The variable cannot contain any special or meta characters or regular expression. We just use string concatenation to create a string.Example import re s = 'I love books' var_name = 'love' result = re.search('(.+)'+var_name+'(.+)', s) print result var_name = 'hate' ... Read More

Rajendra Dharmkar
3K+ Views
It is very easy to do date and time maths in Python using timedelta objects. Whenever you want to add or subtract to a date/time, use a datetime.datetime(), then add or subtract datetime.timedelta() instances. A timedelta object represents a duration, the difference between two dates or times. The timedelta constructor ... Read More

Rajendra Dharmkar
3K+ Views
There is no standard JSON format for dates. Although JavaScript does have a standard date format that is human readable, sorts correctly, includes fractional seconds(which can help re-establish chronology) and conforms to ISO 8601. You can convert a Python date to the JS date format using the strftime function and ... Read More