푸로굴웨밍/python

Jupyter - Markdown, magic command

보늴 2022. 3. 25. 15:33

주피터 상단에서 Code,markdown 등 shell의 모드 설정 가능.

단축키에서 ESC + C 로 마크다운, ESC + Y 로 코드모드

 

크기변경

# - 제일 큼

##

### 로 글씨 크기 변경, 제목-소제목 등으로 사용 

 

<b> bold text <\b><br>

<i>italic text<\i>

<u>underline<\u>

<s>strike out<\s>

<pre> ? <\pre>

 

목차 처럼 구성하기, * 사용

**Unordered list**

* An asterisk(*) starts an unordered list
* This is another item in the list
+ or you can also use the (+) character
- or the (-) character to continue the list

**Ordered list**

1. This starts a list with numbers.
+  This will show as number "2"
*  this will show as number "3."
9. Any number, +, -, or * will keep the list going.
    * Use Tab (4 spaces) to make a sub-list
        1. keep indenting for more sub lists
    * Back to the second level

 

Unordered list

  • An asterisk(*) starts an unordered list
  • This is another item in the list
  • or you can also use the (+) character
  • or the (-) character to continue the list

Ordered list

  1. This starts a list with numbers.
  • This will show as number "2"
  • this will show as number "3."
  1. Any number, +, -, or * will keep the list going.
    • Use Tab (4 spaces) to make a sub-list
      1. keep indenting for more sub lists
    • Back to the second level

 

 

 

 

 

 

Magic command

 

%% 셀 전체에 적용되는 magic command

%   single line 에만 적용되는 

 

%alias alias_name cmd

ex: 

alias bracket echo "input in brackets: <%l>"

bracket hello world

>> "input in brackets: <hello world>"

 

In [1]: alias bracket echo "Input in brackets: <%l>"
    In [2]: bracket hello world
    Out [2]: "Input in brackets: <hello world>"
    
    In [3]: alias parts echo first %s second %s
    In [4]: %parts hello world
    Out [4]: first hello second world

 

%lsmagic

%alias > copy, echo, ddir, ls, mkdir, eren, rmdir등

%pwd 현재 working directory

 

!pip install matplotlib

%matplot inline -> 시각화한걸 셀 안에서 보여주기 위해 깔아줌 

 

html코드 써서 코드모드일 때도 마크다운기능 하도록

%%html

 

<h1>this is the first heading</h1>

<h2> this is the second heading </h2>

 

%%markdown

 

%%python 2 

버전낮은 파이썬으로 지정, 전환해서 쓸 수 있음

%%javascript

%%