본문 바로가기
728x90
반응형

Python286

percent(%) formatting Percent formattingOld Style String Formatting이라고도 불림.파이썬에서 string 내에 variable의 값을 삽입하기 위해 % 연산자를 사용하는 방식.C 언어에서와 매우 유사하기 때문에 "printf-style formatting"이라고도 불림.Python 2.x 대의 주요 string formatting 방법이었으나, 오늘날에는 str의 .format() 메서드나 f-string이 보다 권장됨. 과거의 레거시 코드에서 많이 보이므로 사용법을 알고는 있어야 함.관련 gisthttps://gist.github.com/dsaint31x/a999f4c710d79c9d736f02d4b175c140 py_percent_formatting.ipynbpy_percent_forma.. 2025. 7. 31.
list의 sort() 메서드 와 sorted() 내장 함수 list.sort() 메서드: list를 in-place sorting을 수행함.이 메서드는 원본 리스트를 직접 수정: in-place sorting때문에 정렬된 새 리스트를 반환하지 않음: None 반환기본 사용법: sort in ascending ordersort() 메서드를 argument 없이 호출하면리스트의 요소들을 오름차순(ascending order) 으로 정렬:my_numbers = [3, 1, 4, 1, 5, 9, 2, 6]my_numbers.sort()print(my_numbers)# 출력: [1, 1, 2, 3, 4, 5, 6, 9] str문자는 lexicographical order(사전식 순서)로 sort(정렬)첫번째 요소가 다를 경우, 보다 “작은” 첫번째 요소를 가진 객체가 먼.. 2025. 7. 30.
Compound Statement란? Compound Statment (복합문)란?Compound Statement is a statement that uses a colon :to sperate a header (head) from its body (=suite라고도 불림),which consists of eithera single simple statement on the same line oran indented code block of one or more statements on subsequent lines.정확히 애기하면 header와 suite를 합쳐서 clauses(절) 라고 부르며, Compound Statement는 1개 이상의 clauses로 이루어짐. 1개 이상의 clauses로 이루어진 compound stateme.. 2025. 7. 27.
Magic commands-Jupyter NoteBook&IPython 주요 Magic Commands 정리이 문서는 Jupyter Notebook에서 자주 사용되는 라인 매직(Line Magics)과 셀 매직(Cell Magics)을 소개함. shell-like magic commands는 다음을 참고2023.09.19 - [Python] - [Python] IPython shell 에서 shell cmds 사용하기. [Python] IPython shell 에서 shell cmds 사용하기.IPython 에서 지원하는 shell commandsPython interactive shell에서 OS등이 지원하는 shell commands를 사용하지 못하는 것과 달리, IPython shell에서는 많이 사용되는 shell commands는 다음과 같이 지원함.In [17]:.. 2025. 7. 24.
Jupyter NoteBook-vscode 확장 중심 https://youtu.be/suAkMeWJ1yE?si=YR3b_4aLnYiWCHGd0. Jupyter NoteBook이란?Jupyter Notebook은 "코드, 문서, 시각화"를 하나의 문서에 통합하여 대화형으로 작업할 수 있는 웹 기반 개발 환경으로, REPL Shell을 개선한 IPython의 웹 버전임.2024.09.04 - [개발환경] - [Py] IPython, Jupyter Notebook, and Colab [Py] IPython, Jupyter Notebook, and ColabIPython: IPython은 파이썬의 대화형 인터프리터로, 파이썬 표준 인터프리터보다 향상된 기능을 제공함. 다음과 같은 기능을 제공:Code auto-completionAccess to shell comm.. 2025. 7. 21.
ipynb 파일 (IPython NoteBook) .ipynb는 "IPython Notebook"의 약자임..ipynb 이란:ipynb는 IPython Notebook 의 약자임..ipynb는 IPython 프로젝트의 일부로 개발된 "IPython Notebook"의 파일 형식.i = Interactivepy = Pythonnb = NotebookJupyter Notebook 과 관계IPython 프로젝트가 확장되어 Python 외에도 R, Julia 등 다양한 언어를 지원하게 됨,이름을 Jupyter (Julia + Python + R)로 변경 파일 확장자는 그대로 `.ipynb`를 유지2015년부터는 Jupyter Notebook이 IPython 을 기반으로 정식으로 런칭되면서 Jupyter Notebook의 파일포멧으로 보다 많이 사용됨..ipyn.. 2025. 7. 17.
728x90
반응형