본문 바로가기
목차
Python

[Python] 사용자와 상호작용: 입력받기: input, sys.argv and argparse

by ds31x 2024. 7. 24.
728x90
반응형

input() 함수 사용하기

2023.10.10 - [Python] - [Python] input 함수 사용하여 사용자 입력받기.

 

[Python] input 함수 사용하여 사용자 입력받기.

Python의 input() 함수는표준 입력 스트림(stdin)으로부터 데이터를 입력받는 함수 Terminal에서 수행되는 CLI (Command Line Interface) 프로그램은입력을 stdin (표준 입력, standard input)에서 받아드리고출력은 s

ds31x.tistory.com


sys.argv 사용하기

2023.09.25 - [Python] - [Python] sys 모듈

 

[Python] sys 모듈

Python VM (or Interpreter) 와의 상호작용 담당. sys 모듈은interpreter에 의해 사용되거나 유지되는 variables 와interpreter와 밀접(interpreter 종료 등)하게 관련된 functions 에대한 access를 제공함. 주로 많이 이용

ds31x.tistory.com


Example

2023.10.10 - [Python] - [Python] Example: input, sys.argv and argparse

 

[Python] Example: input, sys.argv and argparse

이자율과 만기(해당 만기 기준의 이자율)을 주고,해당 만기 이자율을 기반으로 일복리로 계산한 경우와 연단리로 계산한 경우를 비교하는 예제임. 입력받는 정보는 다음과 같음.원금이자율(년)

ds31x.tistory.com


다른 모듈 이용하기

argparse 이용하기

2025.08.12 - [Python] - CLI Program에서의 arguments - argparse모듈

 

CLI Program에서의 arguments - argparse모듈

CLI(Command Line Interface) Program (=CLI 명령어)에서 사용되는 arguments 대한 주요 용어Command: 실행할 프로그램/스크립트 이름.예) python, git, lsParameter: 명령 뒤에 오는 모든 인자의 총칭POSIX용어에선 Parameter

ds31x.tistory.com

 

https://dsaint31.tistory.com/477

 

[Python] argparse 사용하기.

argparse 모듈Python에서 기본적으로 제공하는 명령어 인자 파서 모듈이다. command line inerface 으로 프로그램을 만들 때 기본적으로 필요하다.linux 쪽 경험이 풍부한 이들에겐 getopt가 보다 익숙하지만

dsaint31.tistory.com

 

getopt 이용하기

작성예정


같이보면 좋은 자료들

2023.10.06 - [분류 전체보기] - [Python] Python 정리

 

[Summary] Python 정리

Programming Language and Python 소개2023.10.23 - [Python] - [Python] Programming Language and Introduction of Python. [Python] Programming Language and Introduction of Python.Computer and Programhttps://dsaint31.tistory.com/436: computer 의 정의와 pr

ds31x.tistory.com


 

728x90