variables7.2 Python 내 타입 힌트에서 함수 타입을 어떻게 지정할 수 있을까요?, How can I specify the function type in my type hints? 질문 변수의 타입 힌트를 함수 타입으로 지정하는 방법은 어떻게 되나요? typing.Function은 없고, 관련된 PEP인 PEP 483에도 그에 대한 내용을 찾을 수 없었습니다. 답변 As @jonrsharpe noted in a comment, this can be done with typing.Callable: from typing import Callable def my_function(func: Callable): Note: Callable on its own is equivalent to Callable[..., Any]. Such a Callable takes any number and type of arguments (...) and returns a value of any type (A.. 2023. 10. 8. Python 명령 줄 인수에 어떻게 접근하나요? [중복], How do I access command line arguments? [duplicate] 질문 나는 프로젝트 설정 설정을 위해 파이썬을 사용하지만, 명령 줄 인수를 얻는 데 도움이 필요합니다. 터미널에서 다음을 시도해보았습니다: $python myfile.py var1 var2 var3 파이썬 파일에서 입력된 모든 변수를 사용하고 싶습니다. 답변 파이썬 튜토리얼에서는 이를 설명합니다: import sys print(sys.argv) 더 구체적으로 말하면, python example.py one two three를 실행하면: >>> import sys >>> print(sys.argv) ['example.py', 'one', 'two', 'three'] 2023. 9. 9. 이전 1 다음