'์นํจ ํผ์ ํ๋ฒ๊ฑฐ ํ์์ก'.split() # ๋ฌธ์์ด ๋๋๊ธฐ
['์นํจ', 'ํผ์', 'ํ๋ฒ๊ฑฐ', 'ํ์์ก']
๋ถ๋ฆฌ๋ ๋ฌธ์์ด์ ๋ฆฌ์คํธ(List) โ ์ธ๋ฑ์ค๋ก ํน์ ํญ๋ชฉ์ ๋ฌธ์์ด์ ๋ฐํ
coffee_menu = '์์คํ๋ ์,์๋ฉ๋ฆฌ์นด๋
ธ,์นดํ๋ผ๋ผ,์นดํธ์น๋
ธ'
coffee_menu.split(',') # (,)๊ธฐ์ค์ผ๋ก ๋ฌธ์์ด ์๋ฅด๊ธฐ
['์์คํ๋ ์', '์๋ฉ๋ฆฌ์นด๋ ธ', '์นดํ๋ผ๋ผ', '์นดํธ์น๋ ธ']
phone_num = '1234-798-5678'
phone_num.split('-') # (-)๊ธฐ์ค์ผ๋ก ๋ฌธ์์ด ์๋ฅด๊ธฐ
['1234', '798', '5678']
[:] : ์ฒ์๋ถํฐ ๋๊น์ง
[start:] : start๋ถํฐ ๋๊น์ง
[:end] : ์ฒ์๋ถํฐ end-1๊น์ง
s = "์๋ ํ์ธ์."
print("s์ ๊ธธ์ด ์ถ๋ ฅ")
print(len(s))
[์์:์ข
๋ฃ:๋ณดํญ][1,2,3,4,5,6,7,8,9]
s1 = [1,2,3,4,5,6,7,8,9]
ex) [3:] - [3,4,5,6,7,8,9][:-4] - [6,7,8,9]
strip() Istrip() Rstrip()
s1 = " It is python "
s1 = s1.strip()
s1 = " It is python"
s1.lstrip()
s1 = "It is python "
s1.rstrip()
str1 = 'banana'
str2 = 'apple'
str3 = 'QUEEN'
str4 = 'COFFEE'
print(str1.isupper()) =>false
print(str2.islower()) =>ture
print(str3.islower()) =>false
print(str4.isupper()) =>ture