| by Arround The Web

Tkinter Change Label Text

The “config()” function can be applied on the label to change its text, while the “set()” is used on the StringVar variable to change Tkinter Label text.

Share Button
Read More
| by Arround The Web

Factorial in Python NumPy

The numpy.math.factorial() function takes in a positive integer value and returns its factorial back to the caller. However, it does not work for negative values.

Share Button
Read More
| by Arround The Web

Variables in Python: Concepts With Examples, Common Errors

This guide explains variables in Python with basic concepts, including various examples to define and store values in them.
The post Variables in Python: Concepts With Examples, Common Errors appeared first on Linux Today.

Share Button
Read More
| by Arround The Web

Python String to Enum Conversion

The “getattr()” function, “__members__” attribute, or the Enum class method are used to convert the string to Enum in Python.

Share Button
Read More
| by Arround The Web

XOR Two Strings in Python

The “ord()” function converts string values into their ASCII representatives and passes to XOR. “^” operator returns the difference of converted ASCII values.

Share Button
Read More
| by Arround The Web

Input Function in Python: Concepts and Examples

Learn how to get the input function in Python to accept values from standard input and how to process them.
The post Input Function in Python: Concepts and Examples appeared first on Linux Today.

Share Button
Read More
| by Arround The Web

Sort Nested List in Python

In Python, “sort()” and “sorted()” methods sort a nested list in ascending, descending order, based on the index of a tuple or with respect to length.

Share Button
Read More
| by Arround The Web

How to Get Return Code From Process in Python Subprocess Execution?

Use the “returncode” attribute, “communicate()”, or the “check_output” method to get the return code from a process in Python subprocess execution.

Share Button
Read More
| by Arround The Web

Python Extract Substring Using Regex

The “re.match()”, “re.search()”, “re.findall()”, and “re.finditer()” methods of the “re” module are used for extracting substring using regex in Python.

Share Button
Read More
| by Arround The Web

How to Read Pickle File Python?

To read the pickle file in python, use the “load()” method from the pickle package or alternatively use the “read_pickle()” method from the pandas package.

Share Button
Read More
| by Arround The Web

Python Create File If Not Exists

To create a file after checking its non-existence in Python, use the open() method with the “w+” flag or use the pathlib module.

Share Button
Read More
| by Arround The Web

Learn Python Control Flow and Loops to Write and Tune Shell Scripts – Part 2

The post Learn Python Control Flow and Loops to Write and Tune Shell Scripts – Part 2 first appeared on Tecmint: Linux Howtos, Tutorials & Guides .In the previous article of this Python series, we shared a brief introduction to Python, its command-line…

Share Button
Read More
| by Arround The Web

Getting Started with Python Programming and Scripting in Linux – Part 1

The post Getting Started with Python Programming and Scripting in Linux – Part 1 first appeared on Tecmint: Linux Howtos, Tutorials & Guides .It has been said (and often required by recruitment agencies) that system administrators need to be proficient…

Share Button
Read More
| by Arround The Web

Python Pad a String with Leading Zeros

To pad the string with leading zeros in Python, the “f-string“, “format()”, “zfill()”, “rjust()”, and “ljust()” methods can be used.

Share Button
Read More
| by Arround The Web

Python Add String to List

To add the string to the list, the “+” operator, the “insert()” method, the “extend()” method, and the “itertool.chain()” method can be used.

Share Button
Read More
| by Arround The Web

Python Inline If-else

The inline if-else is a logical statement that allows users to preserve the code quality in a single line by replacing the number of lines of “if-else” code.

Share Button
Read More
| by Arround The Web

Python Prepend List

To prepend the Python list, the “+” operator with square brackets “[ ]”, “slicing” method, “insert()“ method and “deque.appendleft()“ method can be used.

Share Button
Read More
| by Arround The Web

Pip Install Tkinter

The pip install tkinter command is used to install the tkinter package, a GUI building tool, in your Python Environment. Read this guide to learn about Tkinter.

Share Button
Read More
| by Arround The Web

Python Substring After Character

To get substring after a character in Python, the “split()” method, the “partition()” method, the “index()” and the “find()” method are used.

Share Button
Read More
| by Arround The Web

Python Check if a String is a Float

To check if a string is float or not in Python, the “float()” method, the “replace()” method and the “isdigit()” method are used.

Share Button
Read More