計算Array :: pack格式字符串的大小

[英]Calculating the size of Array::pack format string


How do you calculate the length of the string that would be returned by Array::pack? Is there something like Python's calcsize?

你如何計算Array :: pack返回的字符串的長度?是否有類似Python的calcsize?

2 个解决方案

#1


1  

array.pack("").count I would say. Not really the fastest method, but it works.

array.pack(“”)。我會說。不是最快的方法,但它的工作原理。

#2


0  

By making an interpreter complying to the specifications found in Array::pack.

通過使解釋器符合Array :: pack中的規范。

Or, reusing the existing implementation to count the number of characters instead of appending them to a string.

或者,重用現有實現來計算字符數,而不是將它們附加到字符串。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2008/09/29/725e8bebe7ae349212ebd433d133c8f6.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com