
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

2K+ Views
Python can connect to oracle using a python package called cx_Oracle. Oracle is one of the famous and widely used database and python’s data processing features are leverages well using this connectivity. In this article we will see how we can connect to oracle database and query the DB.Installing cx_OracleWe can use the below command to install the python package which can be used for establishing the connectivity.Examplepip install cx_OracleConnecting to OracleNow using this module we can connect to a oracle database which is accessible through the oracle service name. We create a cursor and execute the SQl query through ... Read More

1K+ Views
The netrc class in python is used to read the data from the .netrc file presnt in unix systems in user’s home firectory. These are hidden files containing user’s login credential details. This is helpful for tool slike ftp, curl etc to successfully read the ,netrc file and use it for their actions.The below program shows how we can read the .netrc file using python’s netrc module.Exampleimport netrc netrc = netrc.netrc() remoteHostName = "hostname" authTokens = netrc.authenticators(remoteHostName) # Print the access tokens print("Remote Host Name:%s" % (remoteHostName)) print("User Name at remote host:%s" % (authTokens[0])) print("Account Password:%s" % (authTokens[1])) print("Password for ... Read More

2K+ Views
In Python we work with variables, functions, libraries and modules, etc. Sometimes, the variable name you choose may already exist as the name of another variable, function, or method. This can be confusing or it might lead to unexpected behavior in your program. In such scenario, we need to learn about how all these names are managed in Python. This is the concept of namespaces and scoping. Namespaces in Python A namespace is a mapping from names to objects, which means stores the names you define in your program (such as, variable names, function names, class names, etc.) and maps ... Read More

606 Views
Encoders and decoders for the External Data Representation (XDR). When we transport data between different external sources, this is the commonly used format that is used. It useful for creation and transfer of complex data structures. XDR provides a service associated with the OSI Presentation Layer.In the below program we see how the data is getting packed and unpacked using the xdrlib module.Exampleimport xdrlib p = xdrlib.Packer() print(type(p)) lst = [1, 2, 3] p.pack_list(lst, p.pack_int) print(p) u = xdrlib.Unpacker(p) print(type(u)) print(lst)Running the above code gives us the following result −Output [1, 2, 3]Read More

1K+ Views
It is a common requirement during file transfers to encode and decode them for various reasons like encryption, compression or just because they are going to be processed by different OS or file reading programs. The uuencode module helps us on both encoding and decoding files as shown below.Encode the fileWe will use the below image for encoding and later decoding it to get it back.In the below program we use the encode function to encode the given image and read the content of the file after encoding.Exampleimport uu infile = "E:\tp_logo.JPG" uu.encode(infile, 'encoded_logo.JPG') f = open("E:\TP\encoded_logo.JPG", 'r') ... Read More

2K+ Views
Many times we need to deal with data which not always has the regular ASCII characters. For example, an email in a different language other than English. Python has mechanism to deal with such characters by using MIME (Multipurpose Internet Mail Extensions) based module. In this article we will see how we can decode such characters in an email or otherwise in some straight inputs.Using email packageThe email package has modules namely mime and charset which can carry out the encoding and decoding work as shown in the below example. We have taken an email message containing Unicode characters and ... Read More

602 Views
Kivy is an open source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps. It is used to develop the Android application, as well as Desktops applications. In this article we will see how to use events when a button is pressed.In the below example we have created a button and a label in a horizontal BoxLayout. We give initial text to the button and label. Then we create an event for clicking the button which changes the text both in the button and in the label. It is a single ... Read More

723 Views
Kivy is an open source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps. It is used to develop the Android application, as well as Desktops applications. In this article we will see how to use the BoxLayout widget to create buttons of different orientation and colours.In the below code we first create an outer box whose orientation is vertical. Then we create a row 1 with horizontal orientation. Then two other rows again with vertical orientation. We wrap all these rows in the outer box and giver different text and ... Read More

655 Views
Kivy is an open source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps. It is used to develop the Android application, as well as Desktops applications. In this article we will see how to use the anchor layout positioning.Using AnchorLayouts we place the widgets at one of the borders. The class kivy.uix.anchorlayout.AnchorLayout implements the anchor layout. Both the anchor_x parameter and anchor_y parameter can be passed the values ‘left’, ‘right’ and ‘center’. In the below program we create two buttons, attach them to two anchors and keep them in a ... Read More

5K+ Views
Many times python will receive data from various sources which can be in different formats like csv, JSON etc which can be converted to python list or dictionaries etc. But to apply the calculations or analysis using packages like pandas, we need to convert this data into a dataframes. In this article we will see how we can convert a given python list whose elements are a nested dictionary, into a pandas Datframe.We first take the list of nested dictionary and extract the rows of data from it. Then we create another for loop to append the rows into the ... Read More