scope
[Python] python의 변수 스코프
Python의 with 개념을 공부하다가 문뜩 궁금한 점이 생겼다. 아래의 코드에서 contents와 my_file 값이 with 구문을 벗어나도 읽힐까? with open("text.txt", "r") as my_file: contents = my_file.read() print(my_file) # print(contents) # hello 매우 잘 읽힌다... 왜지🤔 https://stackoverflow.com/questions/45100271/scope-of-variable-within-with-statement Scope of variable within "with" statement? I am reading only firstline from python using : with open(fil..