티스토리 뷰

Python

Strings and Console Output

뚜비콩 2017. 9. 7. 20:30

Strings Methods

  1. len() : 길이 출력(공백 문자 포함)
  2. lower() : 모두 소문자로 출력
  3. upper() : 모두 대문자로 출력
  4. str() : 문자열을 출력

Dot Notation


Explicit String Conversation

# Turn 3.14 into a string on line 3!

print "The value of pi is around " + str(3.14)

위와같이 문자열과 숫자의 조합을 출력하고 싶을 땐 숫자를 str() 메소드에 넣어줘야 한다.



'Python' 카테고리의 다른 글

DATE AND TIME  (0) 2017.09.08
댓글