jupyter nbconvert --to notebook --execute

1 개요[ | ]

jupyter nbconvert --to notebook --execute
(base) jovyan@ccd1d41e53d5:~$ cat hello.ipynb 
{
  "cells": [
    {
      "cell_type": "code",
      "metadata": {},
      "source": [
        "print('hello')\n",
        "print('world')"
      ],
      "outputs": [],
      "execution_count": null
    },
    {
      "cell_type": "code",
      "metadata": {},
      "source": [
        "print('lorem')\n",
        "print('ipsum')"
      ],
      "outputs": [],
      "execution_count": null
    }
  ],
  "metadata": {
    "language_info": {
      "name": "python"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 4
}
(base) jovyan@ccd1d41e53d5:~$ jupyter nbconvert --execute --to notebook hello.ipynb
[NbConvertApp] Converting notebook hello.ipynb to notebook
[NbConvertApp] Executing notebook with kernel: 
[NbConvertApp] Writing 1429 bytes to hello.nbconvert.ipynb
(base) jovyan@ccd1d41e53d5:~$ cat hello.nbconvert.ipynb
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-03-15T16:54:21.254009Z",
     "iopub.status.busy": "2021-03-15T16:54:21.253090Z",
     "iopub.status.idle": "2021-03-15T16:54:21.262364Z",
     "shell.execute_reply": "2021-03-15T16:54:21.262926Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello\n",
      "world\n"
     ]
    }
   ],
   "source": [
    "print('hello')\n",
    "print('world')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-03-15T16:54:21.266495Z",
     "iopub.status.busy": "2021-03-15T16:54:21.265685Z",
     "iopub.status.idle": "2021-03-15T16:54:21.270224Z",
     "shell.execute_reply": "2021-03-15T16:54:21.270740Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "lorem\n",
      "ipsum\n"
     ]
    }
   ],
   "source": [
    "print('lorem')\n",
    "print('ipsum')"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}