# 0xa Value Clarrification For Hex Conversion

Page 1 of 1

## 2 Replies - 4390 Views - Last Post: 23 July 2012 - 10:09 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=286719&amp;s=fd57f62f60311368800cf2f27faf4365&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 croog24

Reputation: 2
• Posts: 39
• Joined: 04-February 10

# 0xa Value Clarrification For Hex Conversion

Posted 23 July 2012 - 11:47 AM

Hello everyone!

For practice, I'm making a hex reader. In this scenario, I read a text file and convert the text to hex. Simple enough. However at the end of it is the value 0xa. Is this basically an EOF marker? I've tried the same with just a string and it doesn't appear.

Thank you!

```f = file('test', 'r')
for x in content:
test = bytearray(content)
for i in test:
print hex(i)

```

test file content:
Hello World!

Is This A Good Question/Topic? 0

## Replies To: 0xa Value Clarrification For Hex Conversion

### #2 atraub

• Pythoneer

Reputation: 805
• Posts: 2,142
• Joined: 23-December 08

## Re: 0xa Value Clarrification For Hex Conversion

Posted 23 July 2012 - 12:05 PM

0x0A is equal to decimal ten. This is equal to the ASCII code for LF (Line Feed), which is a newline on many systems.

This post has been edited by atraub: 23 July 2012 - 12:07 PM

### #3 sepp2k

• D.I.C Lover

Reputation: 2201
• Posts: 3,397
• Joined: 21-June 11

## Re: 0xa Value Clarrification For Hex Conversion

Posted 23 July 2012 - 10:09 PM

atraub, on 23 July 2012 - 09:05 PM, said:

LF (Line Feed), which is a newline on many systems.

As long as you open the file in text mode, it's a newline on all systems (which is to say: no matter what the system's native newline character is, Python will translate it to a line feed when reading the file).