"Python"의 두 판 사이의 차이

ph
이동: 둘러보기, 검색
8번째 줄: 8번째 줄:
 
  False
 
  False
 
[http://stackoverflow.com/a/1504742/766330]
 
[http://stackoverflow.com/a/1504742/766330]
 +
 +
  
 
==Access index in {{c|for}} loop==
 
==Access index in {{c|for}} loop==
14번째 줄: 16번째 줄:
 
[http://stackoverflow.com/a/522578/766330]
 
[http://stackoverflow.com/a/522578/766330]
  
== ==
+
 
 +
 
 +
==Max integer==
 +
sys.maxint

2017년 4월 10일 (월) 10:58 판

is and ==

is is identity testing, == is equality testing. what happens in your code would be emulated in the interpreter like this:

>>> a = 'pub'
>>> b = ''.join(['p', 'u', 'b'])
>>> a == b
True
>>> a is b
False

[1]


Access index in for loop

for idx, val in enumerate(ints):
   print(idx, val)

[2]


Max integer

sys.maxint