Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Server Side Programming Articles
Page 69 of 2109
How to check the file size?
Files are used to store certain data based on user requirement. A file can contain any type of information such as audio, text, images, video or program. Depending on the data present in a file, the size of a file varies. The size of a file is measured in bits or bytes. A bit is the smallest unit of information which is typically represented by a single value: either 0 or 1. Bytes are used to measure the amount of data in a file and the bytes are denoted by 8 bits. There are several ways to check the ...
Read MoreHow to check Django version?
Django is a free, open source web framework written in Python that follows the Model-View-Controller (MVC) architectural pattern. It's designed to help developers build web applications quickly and efficiently with minimal complexity. The key features of the Django framework include: Object-Relational Mapper (ORM) for database management URL routing and HTTP request/response handling Template engines for generating HTML pages Built-in user authentication and administration Support for third-party modules and packages Community support and comprehensive documentation Django is widely used by organizations like Google, Pinterest, Mozilla, and Instagram for building scalable and robust web applications. Installing ...
Read MoreHow to check any script is running in linux using Python?
The psutil module in Python helps us retrieve information about processes currently running on our Linux system. This is essential for monitoring and managing scripts programmatically. What is a Script? A script is a set of instructions written in a programming language and executed by the computer. Scripts help us perform repetitive tasks efficiently, from simple file operations to complex system administration. In Linux, scripts are typically executed through command line using shell interpreters like Bash or Python interpreters. These scripts can be scheduled using cron or systemd timers. Method 1: Using psutil Module The psutil ...
Read MoreHow to change ticks label sizes using Python’s Bokeh
Bokeh is a powerful Python data visualization library that creates interactive plots and dashboards for web browsers. When working with Bokeh plots, you may need to customize the tick label sizes to improve readability and visual appeal. This article demonstrates how to change tick label sizes using various Bokeh formatting options. Understanding Tick Labels in Bokeh Tick labels are the text labels that appear along the axes of a plot, indicating the values at specific tick marks. In Bokeh, you can customize these labels using the axis properties and formatting options. Installing Bokeh First, install the ...
Read MoreWays to Convert Boolean Values to Integer in Python
Python is a widely used programming language for web development, data science, machine learning, and automation. Boolean values in Python are represented as True and False. When converting to integers, True becomes 1 and False becomes 0. This article explores different methods to convert Boolean values to integers. Using the int() Function The simplest way to convert Boolean values to integers is using Python's built-in int() function ? # Converting True to integer boolean_value = True integer_result = int(boolean_value) print(f"True converted to integer: {integer_result}") # Converting False to integer boolean_value = False integer_result = int(boolean_value) ...
Read MoreHow to change the PyGame icon?
While building video games, we often want to set a custom image or logo for the developed game. Python's Pygame library provides the set_icon() function to set a custom window icon. Pygame is a set of modules that allows us to develop games and multimedia applications. This is built on top of the SDL (Simple Direct Media Layer) library which provides low-level access to audio, keyboard, mouse, joystick, and graphics hardware through OpenGL and Direct3D. Syntax Following is the syntax for setting the icon for the game ? pygame_icon = pygame.image.load("image_name") pygame.display.set_icon(pygame_icon) Where, ...
Read MoreHow to change the position of legend in Pygal?
Pygal is a Python data visualization library designed to create interactive charts and graphs. Built with advanced SVG (Scalable Vector Graphics) features, it produces high-quality graphics that can be easily embedded into web pages and applications. Installing Pygal You can install Pygal using pip ? pip install pygal Understanding Legends in Pygal The legend adds context and clarity to charts by displaying the names of each data series and their corresponding colors. By default, legends appear at the top of Pygal charts. Changing Legend Position Syntax To change the legend ...
Read MoreWays to Concatenate Boolean to String in Python
Converting Boolean values to strings is a common task in Python programming. Python provides several methods to concatenate Boolean values with strings, each with its own advantages and use cases. Using str() Function The most straightforward approach is using the str() function to convert Boolean values to strings ? # Converting True to string is_active = True message = "User status: " + str(is_active) print(message) # Converting False to string is_logged_in = False status = "Login status: " + str(is_logged_in) print(status) User status: True Login status: False Using f-strings (Formatted ...
Read MoreWays to check if a String in Python Contains all the same Characters
Python provides several ways to check if a string contains all the same characters. This is useful for validating input, pattern matching, or data analysis tasks. Let's explore different approaches with their advantages. Using set() Function The set() function creates a collection of unique characters. If all characters are the same, the set will have only one element ? def check_same_characters(text): return len(set(text)) == 1 # Examples print(check_same_characters("aaaa")) # All same print(check_same_characters("hello")) # Different characters print(check_same_characters("")) ...
Read MorePython - Vowel Indices in String
Finding vowel indices in a string is a common programming task. Python provides multiple approaches including for loops, list comprehension, regular expressions, filter functions, and NumPy arrays. Using For Loop The most straightforward approach iterates through each character and checks if it's a vowel ? def vowel_indices_for_loop(text): vowels = "aeiou" vowel_indices = [] for index, char in enumerate(text): if char.lower() in vowels: ...
Read More