
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Encode and decode XDR data using Python xdrlib
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.
Example
import 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
<xdrlib.Packer object at 0x000002272F3D6FD0> [1, 2, 3]
- Related Articles
- Encode and decode MIME quoted-printable data using Python
- Encode and decode uuencode files using Python
- Encode and decode binhex4 files using Python (binhex)
- Arduino – base64 encode and decode
- Encode and Decode Strings in C++
- What is the difference between encode/decode in Python?
- How to encode and decode URl in typescript?
- How to Encode and Decode JSON and Lua Programming?
- How to encode and decode a URL in JavaScript?
- Decode Ways in Python
- How to encode multiple strings that have the same length using Tensorflow and Python?
- How can Tensorflow be used to decode the predictions using Python?
- Websocket for binary transfer of data & decode with HTML5
- Python Data Science using List and Iterators
- How to encode a URL using JavaScript function?

Advertisements