我想將字符串轉換爲位域。並且,將它們轉換爲二進制然後使用。 需要幫助這個..幫我..需要幫助 - 位域轉換
-3
A
回答
0
他們都是二元的已經...我們在談論哪種語言?
我會先看字符串作爲字符數組,並分別處理每個字符。
+0
@Cogsy - 語言是Python。問題不是很明智。 – 2008-12-22 12:43:25
2
我認爲struct module是你所追求的。使用的
實施例:
>>> from struct import *
>>> pack('hhl', 1, 2, 3)
'\x00\x01\x00\x02\x00\x00\x00\x03'
>>> unpack('hhl', '\x00\x01\x00\x02\x00\x00\x00\x03')
(1, 2, 3)
>>> calcsize('hhl')
8
相關問題
- 1. 需要轉換幫助
- 2. 需要幫助轉換
- 3. 需要幫助將json轉換爲pojo
- 4. 需要Google AdWords轉換跟蹤幫助
- 5. 需要幫助從SQL轉換到LINQ
- 6. 需要幫助轉換SQL到LINQ
- 7. 需要幫助PHP轉換爲C#
- 8. 需要幫助的轉換使用LINQ
- 9. 需要幫助將AsyncTask轉換爲RxJava
- 10. 需要php數組轉換幫助
- 11. 使用WideCharToMultiByte轉換LPCWSTR。需要幫助
- 12. 需要幫助將Jquery轉換爲Mootools
- 13. 需要幫助:Python 2.7.13單元轉換
- 14. 需要幫助定位
- 15. 需要CSS定位幫助
- 16. 需要幫助到32位整型讀轉換爲charcters
- 17. 單位轉換應用程序需要的數組幫助
- 18. 需要旋轉幫助
- 19. XSl - 需要轉型幫助
- 20. jquery幫助需要
- 21. 需要幫助xsl轉換 - 不需要的文本
- 22. CryptoJS.SHA256幫助需要
- 23. 需要幫助InvalidCastException
- 24. 需要幫助
- 25. 需要幫助
- 26. 需要域模型的一些幫助
- 27. cssSandpaper.js幫助需要?
- 28. 需要StructureMap幫助
- 29. 需要幫助suPHP
- 30. 需要幫助從
重複:http://stackoverflow.com/questions/385572/need-help-typecasting-in-python – 2008-12-22 12:35:59