0

Hello,

I'm trying to represent the system date in a sequence such as:
dd mm yy yy

So far i got:
dd mm yyy

so, the year is represented on 2 ytes, but I only have 3 characters, i need to split after the first character and then add a zero in from of the first character.

for example 2012 in hex = 7dc

I need to turn it in
07 DC

I could not find anything regardin spliting without a separator...
Any help is apreciated :)

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by pyTony
0
>>> def split_hex(n):
	print '%02x %02x' % divmod(n, 256)
	print '%c%c' % divmod(n,256)
	return '%c%c' % divmod(n,256)

>>> split_hex(2012)
07 dc
Ü
'\x07\xdc'
>>>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.