Pradeep Elance has Published 445 Articles

Accessing all elements at given Python list of indexes

Pradeep Elance

Pradeep Elance

Updated on 03-Mar-2020 05:31:23

255 Views

We can access the individual elements of a list using the [] brackets and the index number. But when we need to access some of the indices then we cannot apply this method. We need the below approaches to tackle this.Using two listsIn this method, along with the original list, ... Read More

Python - Convert column to separate elements in list of lists

Pradeep Elance

Pradeep Elance

Updated on 26-Feb-2020 08:11:19

231 Views

In analyzing data or processing data using python, we come across situations where the given list has to be remodeled or reshaped to get lists with different columns. We can achieve that with multiple approaches as discussed below.Using SlicingWe can slice the list at certain elements to create the columnar ... Read More

Python - Convert a set into dictionary

Pradeep Elance

Pradeep Elance

Updated on 26-Feb-2020 08:06:33

3K+ Views

Python provides lot of flexibility to handle different types of data structures. There may be a need when you have to convert one Data Structure to another for a better use or better analysis of the data. In this article we will see how to convert a Python set to ... Read More

How to print double quotes with the string variable in Python?

Pradeep Elance

Pradeep Elance

Updated on 26-Feb-2020 07:54:40

13K+ Views

Printing double quotes is tricky, as it itself is required as part of syntax to print the strings by surrounding them. In this article we will see how these double quotes can be printed using print statement.The below scenarios will not print the double quote. The first two lines of ... Read More

Bigram formation from given a Python list

Pradeep Elance

Pradeep Elance

Updated on 26-Feb-2020 07:42:18

714 Views

A bigram is formed by creating a pair of words from every two consecutive words from a given sentence. In python, this technique is heavily used in text analytics. Below we see two approaches on how to achieve this.Using enumerate and splitUsing these two methods we first split the sentence ... Read More

Avoiding quotes while printing strings in Python

Pradeep Elance

Pradeep Elance

Updated on 26-Feb-2020 07:39:41

106 Views

If we print a given list of strings as it is, we have to use quotes and fill in a pair of matching quotes appropriately. We can avoid using quotes in the print statements by following two approaches.Using join()The join method helps us in printing the output of list elements ... Read More

askopenfile() function in Python Tkinter

Pradeep Elance

Pradeep Elance

Updated on 26-Feb-2020 07:36:06

2K+ Views

Instead of hard coding the path to a file to be used by a python program, we can allow the user to browse the os folder structure using a GUI and let the user select the file. This is achieved using the tkinter module in which we define a canvas ... Read More

How to Watch TCP and UDP Ports in Real-time in Linux?

Pradeep Elance

Pradeep Elance

Updated on 25-Feb-2020 06:34:33

812 Views

In a computer network, the network service runs a software in each of the computers that are part of the network. In Linux System this network software uses a protocol called TCP or UDP along with port number. TCP is known as transmission control protocol and UDP is known as ... Read More

How to View Colored Man Pages in Linux?

Pradeep Elance

Pradeep Elance

Updated on 25-Feb-2020 06:24:40

235 Views

The man pages are important reference pages for any Unix user. But their look and feel is very boring because it is just lines of text with some punctuations. In this article we will see how the different parts of the man pages can be coloured and highlighted. That will ... Read More

How to Show Asterisks While Typing Sudo Password in Linux?

Pradeep Elance

Pradeep Elance

Updated on 25-Feb-2020 06:22:00

147 Views

When we use sudo along with a command, we are required to give the password in the next step. But when we start entering the password, we do not see anything displaying on the screen. The screen after the colon symbol remains blank. It creates a difficulty in knowing, how ... Read More

Advertisements