[Tutor] Getting a binary value from a file

Chuk Goodin chukgoodin at gmail.com
Wed Nov 28 19:36:26 CET 2007


Okay, I actually can load the value fine, but then I'm not sure how to do
anything with it.

I have a file full of "integers". If I get a file handle (e.g. file1) and
then read something in, I get back some hex value. How can I go on to use
that in my program?

For example, in interactive mode, file1.read(4) gets me an output of
'/x00/x00/x00/x1c' (might not be exact, I'm at a different computer right
now). Can I just store that in a variable and then somehow convert it to
decimal?

Sorry if this is too newbish.

-- 
chuk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20071128/e6eb8c5f/attachment.htm 


More information about the Tutor mailing list