1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
def func():
    for i in range(10):
        yield i
    return 'exit'
 
for i in func():
    print(i)
 
''' output
0
1
2
...
9
'''
 
cs



마지막 return문의 'exit'는 출력되지 않는다



WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/