Server Side Programming Articles

Page 2104 of 2108

Stack and Queue in Python using queue Module

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 711 Views

In Python, it is very easy to implement stack and queue data structures. Stack is called LIFO because Stack works on the principle of "Last-in, first-out" and Queue is called FIFO because Queue works on the principle of "First-in, first-out", and the inbuilt functions in Python make the code shorter and simple. The Queue module implements multi-producer, multi-consumer queues and It is especially useful in threaded programming when information must be exchanged safely between multiple threads. The Queue class in this module implements all the required locking semantics and it depends on the availability of thread support in Python. This ...

Read More

How to execute Python CGI Script on Apache Server?

Arnab Chakraborty
Arnab Chakraborty
Updated on 30-Jul-2019 599 Views

in apache server normally python script will not run. SO you have to go httpd.conf file in apache server, inside that you will find some .php, .asp etc in a property called AddHandler, you have to put there .py. save the file and restart the server. then run your python CGI script, it will run properly 

Read More

Is C++0x Compatible with C?

Srinivas Gorla
Srinivas Gorla
Updated on 30-Jul-2019 175 Views

Neither C++ (98) nor the new standard(C++0x or C++11) is fully compatible with C. C++ never was fully compatible with C.

Read More

What are the differences between struct and class in C++?

Ramu Prasad
Ramu Prasad
Updated on 30-Jul-2019 423 Views

The members and base classes of a struct are public by default, while in class, they default to private. Struct and class are otherwise functionally equivalent.They are however used in different places due to semantics. a struct is more like a data structure that is used to represent data. class, on the other hand, is more of a functionality inclined construct. It mimics the way things are and work.

Read More

Difference between 'struct' and 'typedef struct' in C++?

Ankith Reddy
Ankith Reddy
Updated on 30-Jul-2019 955 Views

In C++, there is no difference between 'struct' and 'typedef struct' because, in C++, all struct/union/enum/class declarations act like they are implicitly typedef'ed, as long as the name is not hidden by another declaration with the same name.Though there is one subtle difference that typedefs cannot be forward declared. So for the typedef option, you must include the file containing the typedef before it is used anywhere.

Read More

What is a "translation unit" in C++

Srinivas Gorla
Srinivas Gorla
Updated on 30-Jul-2019 3K+ Views

A translation unit is any preprocessed source file.A translation unit is the basic unit of compilation in C++. This unit is made up of the contents of a single source file after it passes through preprocessing. It contains included any header files without blocks that are ignored using conditional preprocessing statements like ifdef, ifndef, etc.A single translation unit can be compiled into an object file, library, or executable program.

Read More

How will you explain Python Operator Overloading?

Jayashree
Jayashree
Updated on 30-Jul-2019 312 Views

Every class in Python, whether built-in or user defined is inherited from object class. The object class has a number of properties whose name is preceded and followed by double underscores (__). Each of these properties is a wrapper around a method of same name. Such methods are called special or magic methods.The magic methods __lt__(), __gt__(), __eq__(), __ne__(), etc. are overridden in a class to overload == and != operators respectively.

Read More

How to change the look of Python operators?

Sai Subramanyam
Sai Subramanyam
Updated on 30-Jul-2019 205 Views

Python and most mainstream languages do not allow changing how operators look. If you're trying to replace something like a == b with a equals b, you can't do that. In Python the restriction is quite intentional — an expression such as a equals b would look ungrammatical to any reader familiar with Python.

Read More

Is there a “not equal” operator in Python?

Pythonista
Pythonista
Updated on 30-Jul-2019 465 Views

In Python 2.x as well as != symbols are defined as 'not equal to' operators. In Python 3, operator is deprecated.

Read More

How to create a Python dictionary from text file?

Jayashree
Jayashree
Updated on 30-Jul-2019 13K+ Views

Assuming a following text file (dict.txt) is present1 aaa2 bbb3 cccFollowing Python code reads the file using open() function. Each line as string is split at space character. First component is used as key and second as valued = {} with open("dict.txt") as f: for line in f:     (key, val) = line.split()     d[int(key)] = val print (d)The output shows contents of file in dictionary form{1: 'aaa', 2: 'bbb', 3: 'ccc'}

Read More
Showing 21031–21040 of 21,074 articles
Advertisements