wotres.tistory.com/entry/def-%EB%92%A4%EC%97%90-None-%EB%98%90%EB%8A%94-str-%EC%9D%98%EB%AF%B8
def 뒤에 -> None 또는 -> str 의미
파이썬 코드를 보다보면 def 펑션 뒤에 -> None 또는 -> str 로 명시된 경우가 있다. > def test(self, a) -> None: print(a) > def test2(self, a) -> str: return '이 펑션은 : ' + 'a' 이렇게 적어주는 경우는..
wotres.tistory.com
파이썬 코드를 보다보면 def 펑션 뒤에 -> None 또는 -> str 로 명시된 경우가 있다.
def test(self, a) -> None:
print(a)
def test2(self, a) -> str:
return '이 펑션은 : ' + 'a'
이렇게 적어주는 경우는 리턴값이 어떠한 상태인지를 명시해주기 위해 사용한다.
'[공부용]참고 사이트 모음 > [python]' 카테고리의 다른 글
python tcp proxy serer - 파이썬 tcp 프록시 서버 (0) | 2021.01.15 |
---|---|
How the heck does async / await work in Python 3.5? (0) | 2021.01.15 |
[python]이벤트 루프 - 파이썬 설명서 주석판 (asyncio 관련) (0) | 2021.01.14 |
[python] 향상된 for문 (0) | 2021.01.14 |
파이썬의 Asterisk(*) 이해하기 (0) | 2021.01.14 |