'format' 태그의 글 목록 — 뚝딱이

format

ERROR

[format] ValueError: cannot switch from manual field specification to automatic field numbering

비슷한 에러 : ValueError: cannot switch from automatic field numbering to manual field specification python format을 사용할 때 발생할 수 있는 에러이다. print('{}{}{1}'.format('1','2','3')) format 사용법 이는 format 자릿수 때문인데 format을 사용할 때 2가지 방법으로 사용할 수 있다. print('{}{}{}'.format('1','2','3')) print('{}{}{}{}'.format('1','2','3')) {}의 개수와 파라미터 개수가 같아야하며 다르면 위와 같은 에러가 발생한다. print('{2}{0}{1}'.format('1','2','3')) 위는 자리수를자릿수..

Python/이론, 기초

[Python] print, format, input

print 함수 ' " 두 개 다 사용 가능하고 혼합사용은 불가능하다. print('Hello') print("World") print('hel','lo') # ,-> 띄어쓰기되어 출력 print('hel''lo') print('hel'+'lo') Hello World hel lo hello hello 확장문자 사용 \' : 따옴표 문자 \" : 쌍따옴표 문자 \ : backslash 문자 \a : bell 문자 \b : backslash 문자 \f : Formfeed 문자 \n : newline 문 \r : carriage return 문자(\n와 동일하지 않다.) \t : tab 문자 \v : vertical tab 문자 ''' ''' , """ """- 작성한 문자열을 그대로 출력 print('''..

파송송
'format' 태그의 글 목록