0
저는 python에 익숙하지 않고 다음과 같은 기본적인 python 구문을 이해하려고합니다. 미리 감사드립니다.python 구문 - 의미 self._setup
foo = self._setup['bar']
업데이트 : 이전 코드 세그먼트의 오타가 수정되었습니다.
저는 python에 익숙하지 않고 다음과 같은 기본적인 python 구문을 이해하려고합니다. 미리 감사드립니다.python 구문 - 의미 self._setup
foo = self._setup['bar']
업데이트 : 이전 코드 세그먼트의 오타가 수정되었습니다.
python
키워드되지 않기 때문에이 유효 파이썬되지 않습니다 :
>>> foo = python self._setup['bar']
File "<stdin>", line 1
foo = python self._setup['bar']
^
SyntaxError: invalid syntax
유효한 파이썬 코드로 구성되어
foo = self._setup['bar']
과 같을 것이다은 다음과 같습니다
self # Get the value of self (typically the current object)
self._setup # Get the attribute "_setup" of that value
self._setup['bar'] # Get the item "bar" of the attribute value
foo = self._setup['bar'] # Assign the result to the variable foo
이를 모두 아주 기본적인 구조입니다. 자세한 내용은 Python tutorial을 참조하십시오.
아아 - 내 질문에 오타가 수정되었습니다. 고마워요 @phihag – cached