Converting integer to string (as in binary), and back
Author |
Message |
DtY
![](http://compsci.ca/v3/uploads/user_avatars/8576159234be48b7a8b0e8.png)
|
Posted: Sun Aug 02, 2009 8:24 pm Post subject: Converting integer to string (as in binary), and back |
|
|
Is there a standard python method to take a string and convert it to an integer, and back. I don't mean like 123456=>"123456", but 123456=>"\x00\x01\xE2\x40", and back with a specified width (in bytes) for the output.
Thanks
[edit] Fixed typo in title
[edit 2] Fixed typo in edit notice about fixing typo >_>
[edit 3] Just remembered, I'd prefer if the output was big endian, but as long as it's system independent, I can just reverse the string if it's not. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
btiffin
![](http://compsci.ca/v3/uploads/user_avatars/189169540547b535e50e4a7.jpg)
|
|
|
|
![](images/spacer.gif) |
|
|