Day: July 12, 2020

Python tutorials for Business Analyst – Python strftime()

(Python Tutorial – 044) Python strftime() In this article, you will learn to convert date, time and datetime objects to its equivalent string (with the help of examples) The strftime() method returns a string representing date and time using date, time or datetime object.   Example 1: datetime to string using strftime() The program below converts a datetime object containing current date and …

Python tutorials for Business Analyst – Python datetime

(Python Tutorial – 043) Python datetime In this article, you will learn to manipulate date and time in Python with the help of examples. Python has a module named datetime to work with dates and times. Let’s create a few simple programs related to date and time before we dig deeper.   Example 1: Get Current Date …

Python tutorials for Business Analyst – Python RegEx

(Python Tutorial – 042) Python RegEx In this tutorial, you will learn about regular expressions (RegEx), and use Python’s re module to work with RegEx (with the help of examples). A Regular Expression (RegEx) is a sequence of characters that defines a search pattern. For example, ^a…s$ The above code defines a RegEx pattern. The pattern is: any …

Python tutorials for Business Analyst – Python Decorators

(Python Tutorial – 041) Python Decorators A decorator takes in a function, adds some functionality and returns it. In this tutorial, you will learn how you can create a decorator and why you should use it. Decorators in Python Python has an interesting feature called decorators to add functionality to an existing code. This is also called meta …

Python tutorials for Business Analyst – Python Closures

(Python Tutorial – 040) Python Closures In this tutorial, you’ll learn about Python closure, how to define a closure, and the reasons you should use it. Nonlocal variable in a nested function Before getting into what a closure is, we have to first understand what a nested function and nonlocal variable is. A function defined …

Python tutorials for Business Analyst – Python Generators

(Python Tutorial – 039) Python Generators In this tutorial, you’ll learn how to create iterations easily using Python generators, how it is different from iterators and normal functions, and why you should use it. Generators in Python There is a lot of work in building an iterator in Python. We have to implement a class with __iter__() and __next__() method, keep …

Python tutorials for Business Analyst – Python Iterators

(Python Tutorial – 038) Python Iterators Iterators are objects that can be iterated upon. In this tutorial, you will learn how iterator works and how you can build your own iterator using __iter__ and __next__ methods. Iterators in Python Iterators are everywhere in Python. They are elegantly implemented within for loops, comprehensions, generators etc. but are hidden …

Python tutorials for Business Analyst – Python Operator Overloading

(Python Tutorial – 037) Python Operator Overloading You can change the meaning of an operator in Python depending upon the operands used. In this tutorial, you will learn how to use operator overloading in Python Object Oriented Programming. Python Operator Overloading Python operators work for built-in classes. But the same operator behaves differently with different types. …