Access and Convert Time Using the Time Library in Python

S Vijay Balaji
Updated on 11-Feb-2021 06:19:16

443 Views

IntroductionThe time library in Python is used to obtain time in the real world and perform various tasks related to it. You can even manipulate execution time using this module.Getting StartedThe time module comes packaged with Python. This means you do not have to install it separately using the PIP package manager.In order to use its various functions and methods, you must first import it.import timePrinting current local timeIn order to print the current local time, we will be using the ctime() function.But firstly, we must obtain the number of seconds since epoch. That is, the number of seconds since ... Read More

Documentation Generation Using the pydoc Module in Python

S Vijay Balaji
Updated on 11-Feb-2021 05:53:24

7K+ Views

IntroductionThe pydoc module automatically generates documentation from Python modules. The documentation can be saved as pages of text on the console, displayed on the web browser, or even as HTML files.In this article you will be learning methods to view these documentations in various cases and even learn about docstrings that help you create your own documentation for your python scripts.Now that you know the use of pydoc, let us get started.Getting StartedThe pydoc module comes packaged along with Python, which means you don’t have to download and install it separately.In order to access pydoc, you can must first import ... Read More

Copy and Paste to Clipboard Using Pyperclip Module in Python

S Vijay Balaji
Updated on 11-Feb-2021 05:50:08

2K+ Views

IntroductionWe will be using the pyperclip module in order to copy and paste content to the clipboard. It is cross−platform and works on both Python 2 and Python 3.Copying and pasting from and to the clipboard could be very useful when you want the output of the data to be pasted elsewhere in a different file or software.Getting StartedThe pyperclip module does not come packaged with Python. In order to access it, you must first download and install it. You can do this using the PIP package manager.Launch your terminal and type the command below to install pyperclippip install pyperclipOnce ... Read More

Accessing the Internet Using urllib.request Module in Python

S Vijay Balaji
Updated on 11-Feb-2021 05:46:33

554 Views

IntroductionWe use the urllib.request module in Python to access and open URLs, which most often use the HTTP protocol.The interface used is also very simple for beginners to use and learn; it uses the urlopen function which can fetch various URLs using a variety of different protocols.You will get a better understanding of what we are working with, once we start using its various functionalities. So, let us get started.Getting StartedThe urllib library comes packaged along with Python. So, you do not need to install it separately, but in case you want to add it to your environment and you ... Read More

Create Dark Light Mode for Websites using CSS

AmitDiwan
Updated on 10-Feb-2021 13:59:59

726 Views

By changing the text-color and background color of a page, we can add dark/light mode for our website.SyntaxThe following syntax can be used to apply dark mode.Selector {    color: white;    background-color: black }Example Live Demo                    div {             font-size: 1.4em;             text-align: center;          }          .dark {             color: white;             background-color: black;          }       ... Read More

Create Black and White Image Using CSS

AmitDiwan
Updated on 10-Feb-2021 13:42:30

9K+ Views

By specifying grayscale value to the filter property of CSS we can create a black and white image. filter property can be used to apply special effects like blur, drop-shadow to images.SyntaxThe syntax of CSS filter property is as follows −Selector {    filter: grayscale(100%);    -webkit-filter: grayscale(100%); }ExampleThe following examples illustrate CSS filter property. Live Demo                    img {             margin: 2%;             border-radius: 25%;          }          img:nth-of-type(even) {             filter: grayscale(100%);             -webkit-filter: grayscale(100%);          }                               This gives the following outputExample Live Demo                    img {             margin: 2%;          }          img:nth-of-type(odd) {             filter: grayscale(100%);             -webkit-filter: grayscale(100%);          }                               This gives the following output

Creating a Responsive Logo with CSS min() Function

AmitDiwan
Updated on 10-Feb-2021 13:29:11

289 Views

Using the CSS min() function, we can create a responsive logo in our webpages. It allows us to specify a minimum value to a CSS attribute.SyntaxThe syntax of CSS min() property is as follows −Selector {    attribute: min(/*value*/, /*value*/); }ExampleThe following examples illustrate CSS min() property. Live Demo                    img {             float: left;             height: min(40vw, 384px);             margin: 3%;          }                 ... Read More

Create Slider Carousel with CSS Flexbox

AmitDiwan
Updated on 10-Feb-2021 13:23:13

2K+ Views

We can create an infinitely scrolling slider using CSS Flexbox with the help of JavaScript.ExampleThe following examples illustrate carousel using CSS. Live Demo                    img {             width: 100%;          }          .container {             max-width: 600px;             position: relative;             margin: 6% auto;          }          .prevbtn, .nextbtn {             position: absolute;   ... Read More

Create a Comment Box with Containing Text Using CSS

AmitDiwan
Updated on 10-Feb-2021 13:05:31

614 Views

Comment box can be created using clip-path propertySyntaxThe syntax of CSS clip-path property is as follows −Selector {    clip-path: /*value*/ }ExampleThe following examples show how we can create a comment box using CSS. Live Demo                    .cb {             position: relative;             padding: 2%;             border-radius: 8%;             width:25%;          }          .cb::after {             content: "";     ... Read More

Count Special Characters in Words Using Python Pandas

Vani Nalliappan
Updated on 10-Feb-2021 12:39:30

635 Views

Input − Assume you have a series, 0       fruits!! 1       *cakes* 2       $nuts 3       #drinks dtype: objectInput − The result for the total number of counts for more than one special character in a series is 2.Let us try to find different solutions to this question.Solution 1To solve this, we will follow the steps given below −Define a SeriesCreate special characters list of values.Set the initial value of special character and total special char count value as 0.Create a for loop and access all the values in the ... Read More

Advertisements