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 So you are curious to know the key difference between a list and tuple in Python ? You can find the answer in many places on the web, however in this code snippet we will summarize it so that it is easy to remember. Take a look at the following table… List vs Tuple
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
Introduction Welcome to a new Python code snippets post. Below, you can find a summary of helpful Python syntax for that purpose… Let us now take some examples… Sorted dictionary keys This will print… Sorted dictionary values This will print… Sorted dictionary items by value This will print… Sorting in reverse order This will print…
Introduction Comparing strings is a very common task in coding. How do we do that in Java ? well there are tons of content in that regard. I compiled the bare minimum that you need in case you are only looking for the syntax. Take a look… Syntax Summary Let us demonstrate that… Source code
Introduction To check service port numbers on a Unix based operating system, you may use one of the following methods… netstat command netstat command is used to display network related data. It is available on most Unix flavors including MacOS. The syntax may vary so it is recommended to check the manual (ex. man netstat
Introduction This is a frequently asked question in Python. In this article, I will only provide a short summary. For more details, you may refer to the full article here. So what is the deal about the yield keyword in Python ? The yield keyword in Python has to do with generator functions. Let us
Introduction Assume we have a directory structure (ex. product source code) and we want to share it with someone. To do that on Unix, we can tar the directory structure (convert to a single file archive) then compress the file. If we do not pay due attention, original file and directory paths can be retained
Introduction On Unix based operating systems (Linux, MacOS, etc) a common task is to search for files. For example, we may need to search for text files only. In this post, we will demonstrate the command line syntax to filter out binary and executable files and only keep text files. Follow the steps below… Create
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