Rajendra Dharmkar has Published 537 Articles

How to convert lowercase letters in string to uppercase in Python?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 19-Oct-2022 09:18:05

You can use the upper() method in Python to convert all lowercase letters in string to uppercase. For example:>>> 'HellO'.upper() HELLO >>> 'leaning tower of pisa'.upper() 'LEANING TOWER OF PISA'

How does concatenation operator work on tuple in Python?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 05-Sep-2022 09:17:09

A tuple is a collection of python objects that are separated by commas which are ordered and immutable. Tuples are sequences, just like lists. The differences between tuples and lists are, that tuples cannot be changed unlike lists and tuples use parentheses, whereas lists use square brackets. tup=('tutorials', 'point', 2022, ... Read More

How to pass Drop Down Box Data to Python CGI script?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 25-Jun-2020 21:12:50

Passing Drop Down Box Data to CGI ProgramDrop Down Box is used when we have many options available but only one or two will be selected.Here is example HTML code for a form with one drop down box − Maths ... Read More

What is the difference between 'except Exception as e' and 'except Exception, e' in Python?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 25-Jun-2020 20:57:23

The difference between using ', ' and 'as' in except statements, is as follows:Both ', ' and 'as' are same functionality wise; but their use depends on the python versions as follows.In Python 2.5 and earlier versions, use of the 'comma' is recommended since 'as' isn't supported.In Python 2.6+ versions, ... Read More

How to configure Apache for Python CGI Programming?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 16-Jun-2020 12:45:17

Configure Apache Web server for CGITo get your server run CGI scripts properly, you have to configure your Web server. We will discuss how to configure your Apache web server to run CGI scripts.Using ScriptAliasYou may set a directory as ScriptAlias Directive (options for configuring Apache). This way, Apache understands ... Read More

How to raise a "File Download" Dialog Box in Python CGI Programming?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 16-Jun-2020 12:35:07

Sometimes, it is desired that you want to give option where a user can click a link and it will pop up a "File Download" dialogue box to the user instead of displaying actual content. This is very easy and can be achieved through HTTP header. For example, if you want ... Read More

How do we do a file upload using Python CGI Programming?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 16-Jun-2020 12:34:27

To upload a file, the HTML form must have the enctype attribute set to multipart/form-data. The input tag with the file type creates a "Browse" button.Example        File:         OutputThe result of this code is the following form −File: Choose file UploadHere ... Read More

How to retrieve cookies in Python CGI Programming?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 16-Jun-2020 12:32:59

Retrieving CookiesIt is very easy to retrieve all the set cookies. Cookies are stored in CGI environment variable HTTP_COOKIE and they will have following form −key1 = value1;key2 = value2;key3 = value3....Here is an example of how to retrieve cookies.#!/usr/bin/python # Import modules for CGI handling from os import environ ... Read More

What is the difference between GET and POST in Python CGI Programming?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 16-Jun-2020 12:31:23

GET and POST MethodsYou must have come across many situations when you need to pass some information from your browser to web server and ultimately to your CGI Program. Most frequently, browser uses two methods two pass this information to web server. These methods are GET Method and POST Method.Passing ... Read More

What are environment variables available in Python CGI Programming?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 16-Jun-2020 12:26:28

CGI Environment VariablesAll the CGI programs have access to the following environment variables. These variables play an important role while writing any CGI program.Sr.No.    Variable Name  Description1CONTENT_TYPEThe data type of the content. Used when the client is sending attached content to the server. For example, file upload.2CONTENT_LENGTHThe length of ... Read More

1 2 3 4 5 ... 54 Next
Advertisements