AK 8911
AK 8911

Reputation: 41

I've written a code to check whether python shell is running in 32bit or 64bit. But the code prints 8 instead of 64

print(struct.calcsize("p") * 8)

The above code prints 8 instead of 32 or 64.

Upvotes: 1

Views: 44

Answers (1)

Nacib Neme
Nacib Neme

Reputation: 889

According to the docs, you're actually looking for struct.calcsize("P"). Uppercase P is the equivalent of void * in C.

Upvotes: 1

Related Questions