Latest Posts From Vijaykrishna Ram

Python – Convert String to List

In Python, if you ever need to deal with codebases that perform various calls to other APIs, there may be situations where you may receive a string in a list-like format, but still not explicitly a list. In situations like these, you may want to convert the string into a list. In this article, we […]

Python String translate()

Python’s in-built method for the String class, str.translate(), is used to map a string with a translation table. The translate() method simply converts it using the translation table rules. Let’s understand more about the method in this article. Syntax of Python String translate() Since the translate() function returns a new string with each character in […]

Python – Concatenate string and int

In Python, we normally perform string concatenation using the + operator. The + operator, however as we know, is also used to add integers or floating-point numbers. So what would happen if we have a string and an int on both sides of the operand? Since Python is a dynamically typed language, we would not […]

Python – Catch Multiple Exceptions

Python always operates on an Exception based model. That is, any errors during the program execution are passed as Exceptions and returned to the programmer, which may be handled accordingly using Exception Handling techniques. Sometimes, it is possible that a process raises more than one possible exception, depending on the flow of control. Thus, we […]

Python – stdin, stdout, and stderr

Before going through this article, let us understand what the terms stdin, stdout and stderr are. Standard input – This is the file-handle that a user program reads to get information from the user. We give input to the standard input (stdin). Standard output – The user program writes normal information to this file-handle. The […]

Python encode() and decode() Functions

Python’s encode and decode methods are used to encode and decode the input string, using a given encoding. Let us look at these two functions in detail in this article. Encode a given String We use the encode() method on the input string, which every string object has. Format: This encodes input_string using encoding, where […]