셸에서의 데이터 처리
Susan Sun
Data Person
Python
문서:
man python
...
-V , --version
실행 파일의 Python 버전을 출력하고 종료합니다.
python --version
Python 3.5.2
예: 기본 Python 사용
which python
/usr/bin/python
터미널에서 Python 대화형 세션 시작:
python
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linuxType "help", "copyright", "credits" or
"license" for more information.
>>>
대화형 세션에서는 Python 문법만 사용:
>>> print('hello world')
hello world
Python 세션 종료 후 터미널로 복귀:
>>> exit()
$
Python 대화형 세션:
대안:
.py 스크립트에 저장python + 스크립트로 실행방법 1
.py 파일 생성
방법 2
echo로 Python 구문을 hello_world.py에 기록하여 동시에 파일 생성echo "print('hello world')" > hello_world.py
파일 내용 확인:
cat hello_world.py
print('hello world')
.py 파일과 같은 디렉터리에 있는지 확인:
ls
hello_world.py
파일명 앞에 python을 붙여 실행:
python hello_world.py
hello world
셸에서의 데이터 처리