본문 바로가기
Learn Hard Way the Python

# Printing, Printing

by decom0405 2016. 10. 24.

10/24


>>>

formatter = "%r %r %r %r"    # formatter의 정의


print formatter % (1, 2, 3, 4)    # formatter 형식으로 프린트 %r 각자리에 1, 2, 3, 4 입력

print formatter % ("one", "two", "tree", "four")    # formatter 형식으로 출력, 각자리에 순서대로 one, two, tree, four 출력

print formatter % (True, False, False, True)    # True, False, False, True 순서대로 출력

print formatter % (formatter, formatter, formatter, formatter)    #정의된 formatter 형식으로 formatter, formatter, formatter, formatter출력

print formatter % (

"I had this thing",

"That's you could type up right"

"But it didn't sing"

"So I said goodnight"

)    # 4가지 문장이 순서대로 출력






반응형

'Learn Hard Way the Python' 카테고리의 다른 글

What was that  (0) 2016.10.31
# Printing, Printing, and Printing  (0) 2016.10.26
# More printing  (0) 2016.10.23
# Strings and Texts  (0) 2016.10.21
# mv  (0) 2016.10.17