4.9. 문자열(Strings) 활용
var1 = 'Hello World!'
var2 = "It's a good thing"var1 = 'Hello World!'
var2 = "Python Programming"
print "var1[0]: ", var1[0]
print "var2[1:5]: ", var2[1:5]
#출력된 결과
var1[0]: H
var2[1:5]: ythovar1 = 'Hello World!'
print "Updated String :- ", var1[:6] + 'Python'
#출력된 결과
Updated String :- Hello Pythonpara_str = """this is a long string that is made up of
several lines and non-printable characters such as
TAB ( \t ) and they will show up that way when displayed.
NEWLINEs within the string, whether explicitly given like
this within the brackets [ \n ], or just a NEWLINE within
the variable assignment will also show up.
"""
print para_strLast updated
Was this helpful?