@@ -125,12 +125,14 @@ ValueError: expected '}' before end of string
>>> a='My name is {0}. I am {1} years old and my student id is {2}'.format('minseong kwon',25,201421094)
SyntaxError: unexpected indent
>>> a='My name is {0}. I am {1} years old and my student id is {2}'.format('minseong kwon',25,201421094) #형식을 갖춘 문자열을 만들 때 사용한다. 이때 문자열 안에 중괄호로 {} 다른 데이터가 들어갈 자리를
#만들어 주고 format() 함수를 호출할때 자리에 들어갈 데이터를 순서대로 넣어주면 된다
>>> a='My name is {0}. I am {1} years old and my student id is {2}'.format('minseong kwon',25,201421094) #형식을 갖춘 문자열을 만들 때 사용한다.
#이때 문자열 안에 중괄호로 {} 다른 데이터가 들어갈 자리를
#만들어 주고 format() 함수를 호출할때 자리에
#들어갈 데이터를 순서대로 넣어주면 된다
>>> a
'My name is minseong kwon. I am 25 years old and my student id is 201421094'
'My name is minseong kwon. I am 25 years old and my student id is 201421094' #정상적으로 출력됨 문자열은 ''로 묶어 주어야 한다.
>>> a='My name is {0}. I am {1} years old and my student id is {2}'.format(minseong kwon,25,201421094)