728x90

http://python.org/downloads 

execute IDLE

>>> friend = 1
>>> Friend = 10
>>> friend
1
>>> Friend
10
>>> #and, as, assert, break, class, continue -> invalid syntax, cannot use as variables.
>>> (a,b) = (1,2) #tuple
>>> [c,d] = [3,4] #list
>>> e=f=g=1
>>> year=2014
>>> month=5
>>> print(year, month)
2014 5
>>> 0o10 #octa
8
>>> 0x10 #hexa
16
>>> 0b10 #binary
2
>>> oct(38)
'0o46'
>>> hex(38)
'0x26'
>>> bin(38)
'0b100110'
>>> type(1)
<class 'int'>
>>> type(2*31)
<class 'int'>
>>> type(3.14)
<class 'float'>

 

728x90

'Python' 카테고리의 다른 글

python list, set, tuple, dictionary  (0) 2014.05.05
python unicode  (0) 2014.05.05
python module  (0) 2014.05.02
python regular expressions2  (0) 2014.05.02
python regular expressions  (0) 2014.05.02

+ Recent posts