문자
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"
예제
"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
+, *
예제
"Doosan"+ "Robotics" → "DoosanRobotics"
"Doo"* 3 → "DooDooDoo"
인덱싱 & 슬라이싱
예제
" Doosan" [0] → "D"
" Doosan" [1:4] → "oos"