How to determine 'word' size in Python

后端 未结 6 417
再見小時候
再見小時候 2021-01-20 00:03

I need to know the number of bytes in a \'word\' in Python. The reason I need this is I have the number of words I need to read from a file; if I knew the number of bytes in

6条回答
  •  太阳男子
    2021-01-20 00:48

    Perhaps the following might be relevant and helpful: Suppose you checking for 32-bits. See if (-1)<<31 comes back as long or not. For 32-bit, it does not, while (-1)<<32 and 1<<31 do.

提交回复
热议问题