[python] hello world, OSX

Python 2013. 12. 15. 02:21

먼저 파이썬 버전을 정한다.


2.x버전은 OSX에 이미 깔려있다.

-> 터미널에서 Python -V로 확인

3.x버전을 사용하려면, 새로 다운로드받아서 깔아야한다.

http://www.python.org/download/


두버전간의 문법도 틀림.

2.x를 유지하는 이유는 3.x버전에서는 하위호환성이 없기 때문이란다.



helloworld.py

#!/usr/bin/python


#print "hello world"   <- ver2 style    <- Pythone의 주석문은 #

print("hello world")  <- ver3 




python3 helloworld.py

Posted by tenn
,

- (NSString *) platform

{

    size_t size;

    sysctlbyname("hw.machine", NULL, &size, NULL, 0);

    char *machine = malloc(size);

    sysctlbyname("hw.machine", machine, &size, NULL, 0);

    NSString *platform = [NSString stringWithUTF8String:machine];

    free(machine);

    return platform;

}



http://iphonedevsdk.vanillaforums.com/forum/iphone-sdk-development/88107-getting-the-model-of-the-device.html


Posted by tenn
,




dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 10 * NSEC_PER_SEC), dispatch_get_current_queue(), ^{
    ...
});




http://stackoverflow.com/questions/4139219/how-do-you-trigger-a-block-after-a-delay-like-performselectorwithobjectafter

Posted by tenn
,