How to create new files?

Evan Klitzke evan at yelp.com
Thu Jul 12 18:58:10 EDT 2007


On 7/12/07, Larry Bates <larry.bates at websafe.com> wrote:
> sizeof() in Python is len()

No, sizeof in C/C++ is not like len (len is more like strlen). For
example, on my computer compiling

#include <stdio.h>
#include <string.h>

int main(int argc, char ** argv) {
        char * hello = "Hello World";
        printf("sizeof: %d\n", sizeof(hello));
        printf("strlen: %d\n", strlen(hello));
        return 0;
}

prints out 11 for strlen but only 4 for sizeof because that is the
size of a char *. AFAIK there isn't a true equivalent to sizeof in
python (I hear there is an implementation in mxtools, however).

-- 
Evan Klitzke <evan at yelp.com>



More information about the Python-list mailing list