[Tutor] question about ord

Liam Clarke-Hutchinson Liam.Clarke-Hutchinson at business.govt.nz
Tue Nov 15 22:05:04 CET 2005


Hmm, 

Never thought of doing it that way.

try - 

import struct

a = theByte
value = ord(a)
theByteReloaded = struct.pack("i",value)

You nmay want to check the docs for the struct module at python.org on that
pattern.


Liam Clarke-Hutchinson


-----Original Message-----
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On Behalf
Of nephish
Sent: Wednesday, 16 November 2005 9:46 a.m.
To: tutor
Subject: [Tutor] question about ord


Hey there,
	i am using a script to change a byte into an integer
like this:
	a = the byte
	value = ord(a)

but i cant find the operation that can change it back to a byte. i am sure
its easy, but i am missing how to do it.

thanks for any tips

sk

_______________________________________________
Tutor maillist  -  Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor

A new monthly electronic newsletter covering all aspects of MED's work is now available.  Subscribers can choose to receive news from any or all of seven categories, free of charge: Growth and Innovation, Strategic Directions, Energy and Resources, Business News, ICT, Consumer Issues and Tourism.  See http://news.business.govt.nz for more details.




http://www.govt.nz - connecting you to New Zealand central & local government services

Any opinions expressed in this message are not necessarily those of the Ministry of Economic Development. This message and any files transmitted with it are confidential and solely for the use of the intended recipient. If you are not the intended recipient or the person responsible for delivery to the intended recipient, be advised that you have received this message in error and that any use is strictly prohibited. Please contact the sender and delete the message and any attachment from your computer.


More information about the Tutor mailing list