Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 구글애널리틱스
- GPT
- 태블로
- 생성AI
- bigquery
- Q
- ChatGPT
- 데이터분석
- 서평
- Ga
- 챗GPT
- openAI
- 북리뷰
- tableau
- datastudio
- review
- 데이터시각화
- 필사
- 파이썬
- 빅쿼리
- r
- SQL
- AZURE
- Adobe
- AWS
- Python
- 책리뷰
- 데일리
- diary
- daily
Archives
- Today
- Total
가볍게 배우고 깊게 즐기고 오래 남기기
[Pyton || Tip] nbformat 라이브러리를 활용한 노트북파일(ipynb) py변환 본문
Programming & Tip/Python
[Pyton || Tip] nbformat 라이브러리를 활용한 노트북파일(ipynb) py변환
Awesomist 2024. 5. 20. 14:03728x90
import nbformat
notebook_path = 'name.ipynb'
with open(notebook_path, 'r', encoding='utf-8') as f:
notebook = nbformat.read(f, as_version=4)
code_cells = [cell for cell in notebook.cells if cell.cell_type == 'code']
script_content = "\n\n".join(cell.source for cell in code_cells)
# Save the script to a .py file
script_path = 'name.py'
with open(script_path, 'w', encoding='utf-8') as f:
f.write(script_content)
script_path
https://github.com/jupyter/nbformat
GitHub - jupyter/nbformat: Reference implementation of the Jupyter Notebook format
Reference implementation of the Jupyter Notebook format - jupyter/nbformat
github.com
반응형
'Programming & Tip > Python' 카테고리의 다른 글
Comments