살아가는 이야기

Python 2.x와 3.x 비교 본문

컴퓨터, 풀어그림

Python 2.x와 3.x 비교

우균 2013. 8. 9. 15:21

Python 2.x와 3.x가 너무 많이 바뀌어서 여기에 차이점을 기록해 둔다. 계속 추가해 나갈 생각이다.

 Python 2.x 

 Python 3.x

 print x

 print(x)

 print "%d%f%s"%(n,x,s)

 print("%d%f%s"%(n,x,s))

 print x ,

 print(x, end=" ")

 print >>ofile, x

 print(x, file=ofile)

 string.split(s, sep)

 s.split(sep)

 string.join(lst, connector)

 connector.join(lst)

 raw_input(prompt)

 input(prompt)

 input(prompt)

 eval(input(prompt))

 range(a,b,s)

 list(range(a,b,s))

 map(...)

 list(map(...))

 filter(...)

 list(filter(...))

 gen.next()

 next(gen)

Python 2.x와 3.x를 비교한 문서는 아래 링크에서 찾아볼 수 있다.

http://docs.python.org/3.0/whatsnew/3.0.html

Comments