print("쌍따옴표를 쓰는 방법")
print('홑따옴표를 쓰는 방법')
print("""쌍따옴표를 3개 쓰는 방법""")
print('''홑따옴표를 3개 쓰는 방법''')
print("'문자열 안에 따옴표를 포함시키고 '싶을 때")
print('"문자열 안에 따옴표를 포함시키고 "싶을 때')
print("\'문자열 안에 따옴표를 포함시키고 싶을 때 \\ 사용 ← 이걸 많이 쓸듯")
print("문자열에서\n \\n이 사용가능")
print("""이렇게
된다
자동 줄 바꿈
""")
front = "python"
back = "study"
mix = 2
# 문자열 이어 붙히기
print(front + back)
# 문자열을 곱하는 것도 가능하다
print(front * mix)
print("=" * 50) # ==========
print("이런게 되네")
print("=" * 50) # ==========
# len은 문자열의 길이를 구하기 위해서 사용한다. java의 length, length()처럼
print(len(front))
# 문자열 인덱싱이 가능하다. 배열처럼
print(front[0]) # p
print(front[0:4]) # pyth
print(front[2:]) # thon
print(front[:4]) # pyth
print(front[:len(front)]) # python
print("this is %s and %s" %(front, back)) # this is python and study
print("%10s" % 'hi') # hi
print("%-10sjane." % 'hi') # hi jane.
print("%0.4f" % 3.42134234) # 3.4213
print("%10.4f" % 3.4213423) # 3.4213
# format 함수 사용가능
print("I eat {0} apples".format(3)) # I eat 3 apples
print("I eat {0} apples".format("five")) # I eat five apples
# I ate python apples. so I was sick for study days.
print("I ate {0} apples. so I was sick for {1} days.".format(front, back))
# I ate 10 apples. so I was sick for 3 days.
print("I ate {number} apples. so I was sick for {day} days.".format(number=10, day=3))
print("{0:<10}".format("hi")) # hi .. # 왼쪽 정렬
print("{0:>10}".format("hi")) # hi # 오른쪽 정렬
print("{0:^10}".format("hi")) # hi . # 가운데 정렬