How to get formatted date and time in Python?

Vikram Chiluka
Updated on 31-May-2024 12:22:11

98K+ Views

In this article, we will show you how to format date and time in python. The datetime module in Python offers methods for working with date and time values. To use this module, we must first import it using the following import keyword− import datetime strftime function() The strftime() function returns a formatted date and time. It accepts a format string that you can use to get the result you want. The following are the directives that it supports. Directive Meaning %a Locale's abbreviated weekday name %B Locale's full month name. ... Read More

How to import other Python files?

Rajendra Dharmkar
Updated on 31-May-2024 12:20:05

80K+ Views

The task or process of importing other files in Python allows you to use functions, classes, or variables defined in those files within your current Python script. In this article, we will explore different ways to import other Python files, including built-in modules, user-defined modules, and importing specific functions or variables. By the end of this article, you will have a solid understanding of how to import and use code from other Python files in your current projects. Along the way, we will use code examples followed by lucid explanations to help you understand the above task. Importing a User-Defined ... Read More

How to pass command line arguments to a python Docker container?

Hemant Sharma
Updated on 31-May-2024 12:15:05

13K+ Views

Before getting into the docker container arguments we must know about python command line arguments and how they are accessed by the developer. Command line arguments are of great use when we want our python script to be controlled outside of the program. Access the python script’s command line arguments Step 1: Create a python script main.py Example # sys will allow us to access the passed arguments import sys # sys.argv[0] access the first argument passed that is the python script name print("File or Script Name is :", sys.argv[0]) # print arguments other than the file name ... Read More

How to install Tkinter in Python?

pawandeep
Updated on 31-May-2024 12:07:26

466K+ Views

Tkinter is a standard library in Python which is used for GUI application. Tkinter has various controls which are used to build a GUI-based application.To install Tkinter, we need Python pre-installed. Tkinter actually comes along when we install Python. While installing Python, we need to check the td/tk and IDLE checkbox. This will install the tkinter and we need not install it separately.However, if we missed installing Tkinter while installing Python, we can do it later using the pip command.Step 1 − Make sure Python and pip is preinstalled on your systemType the following commands in command propmt to check ... Read More

What is the full form of ISC?

Shirjeel Yunus
Updated on 30-May-2024 12:19:06

81 Views

What is ISC? The full form of ISC is Indian School Certificate. ISC is an examination which is conducted by CISCE for students of class 12 all over India. ISC exam is similar to the exam of class XII conducted by ICSE. The exam has been made valid by the government of India and other countries. Students who have completed their high school are eligible to take this exam which is conducted by the Council for the Indian School Certificate Examination (CISCE). CISCE is an independent and non-government board of India. UGC (University Grants Commission) and the government of India ... Read More

Containers in C++ STL

sudhir sharma
Updated on 29-May-2024 13:11:59

1K+ Views

The C++ STL (Standard Template Library) is a powerful set of C++ template classes to provide general-purpose classes and functions with templates that implement many popular and commonly used algorithms and data structures like vectors, lists, queues, and stacks.It is a library of container classes, algorithms, and iterators. It is a generalized library and so, its components are parameterized. Working knowledge of template classes is a prerequisite for working with STL.Templates are a feature of the C++ programming language that allows functions and classes to operate with generic types. This allows a function or class to work on many different ... Read More

Python Pandas – How to use Pandas DataFrame tail( ) function

Vani Nalliappan
Updated on 27-May-2024 11:21:00

480 Views

Write a Python code to find price column value between 30000 to 70000 and print the id and product columns of the last three rows from the products.csv file. Result for price column value between 30000 to 70000 and id and product columns last three rows are −    id product 79 80 Truck 81 82 Bike 98 99 TruckSolution 1 Read data from products.csv file and assign to dfdf = pd.read_csv('products.csv ')Apply pandas slicing to access all rows of price column between 30000 to 50000 as, df[df.iloc[:, 4].between(30000, 50000)Save the above result to df1Apply slicing to access last ... Read More

Configure sendmail with Gmail on Ubuntu

Satish Kumar
Updated on 24-May-2024 16:36:27

7K+ Views

Sendmail is a popular mail transfer agent used to send emails from one computer to another. It may installed by default on Ubuntu, which makes it a convenient option to sending emails from server. If you use Gmail, you can configure sendmail to send emails through Gmail account. In this article, we will show you the process of configuring sendmail with Gmail on Ubuntu. Requirements Before starting, there are few requirements that need to configure sendmail with Gmail on Ubuntu − A Gmail account A Ubuntu server Sendmail installed on your Ubuntu server OpenSSL installed on your Ubuntu server ... Read More

Maximum Sum Decreasing Subsequence in C++

Revathi Satya
Updated on 22-May-2024 11:57:17

247 Views

In this article, we are given an array arr[] of N integers. Our task is to find the Maximum Sum Decreasing Subsequence in C++. A Maximum Sum Decreasing Subsequence (MSDS) is a subsequence of a given sequence of array. Here the sequence elements are ordered in decreasing arrangement and the sum of these elements is the highest. Here, given a sequence of array a1, a2, …, an, the goal is to find a subsequence ai1, ai2, …, aik, where i1>i2>…>i1, such that we say the subsequence is ai1>ai2>…>aik (ordered in a decreasing order). The sequence of terms ai1+(ai2)...+(aik) is ... Read More

Maximum sum of distinct numbers with LCM as N in C++

Revathi Satya
Updated on 22-May-2024 11:56:22

228 Views

In this article, we are given a number N. Our task is to create a program to find the maximum sum of distinct numbers with LCM as N in C++. To achive this first of all we need to find the sum of maximum numbers that have N as the Lowest Common Multiple (LCM). For better understanding Let us go through 3 key concepts − Least Common Multiple (LCM): The lowest common multiple(LCM) of two or more integers is the smallest positive integer that is divisible for all of the integers. For example, the LCM of 4 and 5 ... Read More

Advertisements