Introduction If you skim through Python source code, you may encounter some strings proceeded by a special character such as (b, u). What are these characters? Let us see… The b string prefix The b string prefix in Python 3.x indicates that the string is of type byte stream. If the prefix is not used,
Introduction In this tiny Python code snippet article, I am going to borrow from the full article about the topic that you can find here. So, what is the difference between bytes and bytearray in Python ? There is no real difference between byte strings and byte arrays except the fact that byte strings are
Introduction On the surface, this question looks innocent but if we dig a bit deeper, things start to get confusing. In this short post, we will provide a summary of differences, however to better understand the topic, I recommend that you check the full article here. Depending on which version of Python we are using
Problem In this Python code snippet, we are going to implement a naive run length encoding algorithm to compress strings Solution The idea is very simple, text has redundancy so instead of sending plain text, we can compress text by sending characters and their counts. This is a typical text processing problem that gets asked
Introduction Today, we are going to talk about base64 encoding in Python. Understanding how characters are represented is very important to make sense of base64. For beginners, I highly recommend that you check the following article. It explains how Python handles Unicode and string data types. Let us get started… What is base64 encoding? Base64
Introduction Unicode in Python is not a beginner level topic. To get a better understanding, proper introduction is required. For the sake of this post, we are only going to provide few code snippets to demonstrate the conversion of unicode to string and visa versa. For detailed information about Unicode in Python, it is recommended
Introduction Unicode is an important topic in computing but it is a little bit confusing. In particular, it can be more confusing in the context of Python programming language. For that reason, the aim of our article today is to clarify the ambiguity and hopefully put things into perspective. Beginners may get confused because they
Introduction This is a commonly asked question among beginners and students. In this post, we are going to clarify the main differences between the two terms by providing basic definitions as well as indicating why (when) they are used. Let us begin with encoding… What is encoding? Encoding is the process of transforming data (ex.
LZW Algorithm: Introduction It is beyond our imagination to specify a ceiling for the amount of information that an individual or a group of people potentially need to store and/or exchange. Using computer systems, almost all kinds of information can be digitized and therefore saved to storage media or sent across channels all over the