前言
在家实在太无聊了…看到百度深度学习的比赛,这不就是我一直想学的么,直接上手学习,第一次参加没有比赛得奖压力的比赛。
Notebook快捷操作
运行当前cell并移动到下一个cell:shift + enter
单纯运行当前cell:ctrl + enter
移动到上一个cell:ctrl + ↑
移动到下一个cell:ctrl + ↓
Notebook执行终端命令
终端命令前加感叹号用于区分代码
创建新文件newfile.py命令:
!cat <<newfile > newfile.py
查看当前目录中所有文件:
!ls
显示当前路径:
!pwd
安装文件(不支持apt-get):
!pip install ...
查看当前环境中的安装包:
!pip list --format=columns
查看预装的软件:
!apt list
永久安装:
!mkdir /home/aistudio/external-libraries
!pip install beautifulsoup4 -t /home/aistudio/external-libraries
以下方式使用:
import sys
sys.path.append('/home/aistudio/external-libraries')
查询所以magic命令(Magic 命令的前面带有一个或两个百分号(% 或 %%),分别代表行 Magic 命令和单元格 Magic 命令。):
%lsmagic
写入py文件:
%%writefile SaveToPythonCode.py
读取py文件:
%pycat SaveToPythonCode.py