Skip to main content
Skip table of contents

문자

String

기능

모든 문자열은 기본적으로 유니코드입니다.

  • Escape characters
    \n: New line
    \t: Tab
    \r: Carrage return
    \0: Null string
    \\: back slash(\) in string
    \’: single quote mark in string
    \": double quote mark in string

  • String concatenation: "py"+ "tyon" "python"

  • String repeatition: "py"* 3 "pypypy"

  • String indexing: "python" [0] "p"

  • String slicing: "python" [1:4] "yth"

예제

PY
"string1"
'string2'

tp_log("st"+"ring")
#expected result: string
tp_log("str"* 3)
#expected result: strstrstr
tp_log("line1\nline2")
#expected result: line1
# line2
tp_log("\"string\"")
#expected result: "string"
tp_log("str"[0])
#expected result: s
tp_log("string"[1:3])
#expected result: tr

+, *

예제

PY
"Doosan"+ "Robotics" → "DoosanRobotics"
"Doo"* 3 → "DooDooDoo"

인덱싱 & 슬라이싱

예제

PY
" Doosan" [0] → "D"
" Doosan" [1:4] → "oos"
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.