- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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.
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 −
<xdrlib.Packer object at 0x000002272F3D6FD0> [1, 2, 3]
- Encode and decode MIME quoted-printable data using Python
- Encode and decode uuencode files using Python
- Encode and decode binhex4 files using Python (binhex)
- Encode and Decode Strings in C++
- Arduino – base64 encode and decode
- How to Encode and Decode JSON and Lua Programming?
- What is the difference between encode/decode in Python?
- 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
- Program to recover decode XORed array in Python