Category Archives: Python

Python time sleep() Method (Tutorial)

Python Time Sleep() Method

This is a detailed tutorial of the Python sleep() Method. Learn to suspend the execution of a given Python program or code for a given number of seconds. Python time sleep() The method sleep() of the Python time module is used to suspend the execution of a given Python program for the desired number of […]

Python if __name__ == “__main__” Explanation

If Name == Main

Find out what is if __name__ == “__main__” in Python and its purpose. Learn about the __name__ attribute and when its value is set to “__main__”. What is if __name__ == “__main__”? You might have seen the following line of code in numerous python programs. if __name__ == “__main__” But what is its purpose? Let’s […]

Sending Emails in Python using SMTP (Tutorial)

Sending Emails Using Python

Follow this step by step tutorial to send emails with Python. Learn to do the SMTP settings and other configurations to send a text or HTML based email. How To Send Emails in Python? As many of your might already know that the SMTP (Simple Mail Transfer Protocol) is used to send and route the […]

Python Generators – Yield Statement, Expressions & Methods

Python Generators – Yield Statement & Expressions

This is a detailed tutorial of the Python Generators. Learn about yield statement, generator expressions and the send(), throw() and close() methods. What are Python Generators? These are a special kind of functions that instead of returning one value, at last, keeps the ability to return multiple values as the time passes and function processing […]

How to create a zip or tar archive in Python? (Tutorial)

Creating ZIP Or TAR Archive For A Given Directory

Learn to create a zip or tar archive of a particular directory in python using two different methods with the help of illustrative examples. You can also watch the following video presentation instead of reading this article. Creating ZIP or TAR Archive in Python Two different methods to create archives in Python are explained and […]

Python String rpartition() Method

Python String Rpartition() Method

This is a tutorial of the Python String rpartition() method. Learn to partition a given string into a 3-item tuple. (Left Part, Splitting Part, Right Part) Python String rpartition() This method returns a 3-element tuple for a given string such that it contains three parts created after splitting the original string from the last occurrence […]

Python String partition() Method

Python String Partition() Method

This is a tutorial of the Python String partition() method. Learn to partition a given string into a 3-item tuple. (Left Part, Splitting Part, Right Part) Python String partition() This method returns a 3-element tuple for a given string such that it contains three parts created after splitting the original string from the first occurrence […]

Python String rstrip() Method

Python String Rstrip() Method

This is a tutorial of the Python String rstrip() method. Learn to get the copy of a given string with specified trailing characters removed from it. Python String rstrip() This method returns a new copy of the given string in which the characters specified in the argument are removed from the trailing edge of the […]

Python String lstrip() Method

Python String Lstrip() Method

This is a tutorial of the Python String lstrip() method. Learn to get the copy of a given string with specified leading characters removed from it. Python String lstrip() This method returns a new copy of the given string in which the characters specified in the argument are removed from the leading edge of the […]

Python String upper() Method

Python String Upper() Method

This is a tutorial of the Python String upper() method. Learn to covert a given Python String into uppercase using this method with the help of examples. Python String upper() The str.upper() method returns a string in which all of the characters of a given Python String are converted into their uppercase forms. Note. The […]