개발하기/파이썬들
파이썬 파이참 05-16
torrms
2022. 5. 18. 15:36
2022-05-16 기록
- 한글로 된 경로가 있는 경우 파이참에 python3.x 다운로드해서 처리 하려고 해도 자동으로 인식 되지 않아서직접 입력해야 함
- 버전업에 따라서 select or switch 형태의 내부 함수가 추가 (match 문법 생성) python 3.10 이상
- https://www.ciokorea.com/news/185423
- 공부 할줄 추가 해야 한다. 용법도 다행해지는건 당연하 상태
- if / elif /else 를 경우 수가 많은 경우 대체로 사용한다.
- default 값을 지정하고 사용을 권장
match command.split():
case ["quit"]:
print("Goodbye!")
quit_game()
case ["look"]:
current_room.describe()
case ["get", obj]:
character.get(obj, current_room)
case ["go", direction]:
current_room = current_room.neighbor(direction)
# The rest of your commands go here
case _:
# default --> 의식적으로 넣어주는 것이 정신건강에 이롭다.
pass
출처 : https://peps.python.org/pep-0636/
PEP 636 – Structural Pattern Matching: Tutorial | peps.python.org
PEP 636 – Structural Pattern Matching: Tutorial Author Daniel F Moisset Sponsor Guido van Rossum BDFL-Delegate Discussions-To Python-Dev list Status Final Type Informational Created 12-Sep-2020 Python-Version 3.10 Post-History 22-Oct-2020, 08-Feb-2021 Re
peps.python.org