포스트

IPython_And_Shell_Commands

IPython_And_Shell_Commands

IPython_And_Shell_Commands

IPython과 shell 명령어

1
%ls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 D 드라이브의 볼륨: JIINNN
 볼륨 일련 번호: 20A8-6B0F

 D:\A\AI_Programming 디렉터리

2024-04-06  오후 04:53    <DIR>          .
2024-04-06  오후 04:00    <DIR>          ..
2024-04-06  오후 04:42    <DIR>          .ipynb_checkpoints
2024-04-06  오후 04:26             8,460 Basic_IPython.ipynb
2024-04-06  오후 04:34             3,067 Basic_IPython.md
2024-04-06  오후 04:40             5,603 Input_And_Output_History.ipynb
2024-04-06  오후 04:41               944 Input_And_Output_History.md
2024-04-06  오후 04:53             5,360 IPython_And_Shell_Commands.ipynb
2024-04-06  오후 04:16               134 myscript.py
               6개 파일              23,568 바이트
               3개 디렉터리  233,442,889,728 바이트 남음
1
2
# automagic 사용 시 % 생략 가능
pwd
1
'D:\\A\\AI_Programming'
1
2
echo
"출력"
1
"출력"

shell에 값 전달 및 받기

1
contents = %ls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 D 드라이브의 볼륨: JIINNN
 볼륨 일련 번호: 20A8-6B0F

 D:\A\AI_Programming 디렉터리

2024-04-06  오후 04:53    <DIR>          .
2024-04-06  오후 04:00    <DIR>          ..
2024-04-06  오후 04:42    <DIR>          .ipynb_checkpoints
2024-04-06  오후 04:26             8,460 Basic_IPython.ipynb
2024-04-06  오후 04:34             3,067 Basic_IPython.md
2024-04-06  오후 04:40             5,603 Input_And_Output_History.ipynb
2024-04-06  오후 04:41               944 Input_And_Output_History.md
2024-04-06  오후 04:53             5,360 IPython_And_Shell_Commands.ipynb
2024-04-06  오후 04:16               134 myscript.py
               6개 파일              23,568 바이트
               3개 디렉터리  233,442,889,728 바이트 남음
1
print(contents)
1
None
1
directory = %pwd
1
print(directory)
1
D:\A\AI_Programming
1
type(directory)
1
str
1
message = "Hello"
1
2
%echo
{message}
1
Hello
이 기사는 저작권자의 CC BY-NC 4.0 라이센스를 따릅니다.