如何在Jupyter Lab中运行.py文件?

当前文件夹:

  • t.ipython
  • test.py

test.py:

print("Hello, SageMaker studio lab!")

在Jupyter Lab中运行.py文件有两种方法

1. 将文件导入ipython的cell中

示例代码:

%load test.py

运行结果:

2. 直接运行.py文件

示例代码:

%run test.py

运行结果:

posted @ 2022-01-04 14:06  刷书狂魔  阅读(1966)  评论(0编辑  收藏  举报
总访问: counter for blog 次