Calculating the size of a string Array :: pack

How do you calculate the length of the string that will be returned by Array :: pack? Is there something like python calcsize?

+3
source share
2 answers

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

+1
source

By making a translator that meets the specifications found in Array :: pack .

Or reusing an existing implementation to count the number of characters instead of adding them to a string.

0
source

Source: https://habr.com/ru/post/1697650/


All Articles