๐ ์ ๋ ฅ
input
- input์ ํตํด ์ฌ์ฉ์๊ฐ ์ ๋ ฅํ ๊ฐ์ ๋ณ์๋ก ๋ฐ์ ์ ์๋ค.
- input์ ์ ๋ ฅ๋ ๋ชจ๋ ๊ฒ์ ๋ฌธ์์ด๋ก ์ทจ๊ธํ๋ค.
a = input()
- input() ๊ดํธ ์์ ์ง๋ฌธ์ ์ ๋ ฅํ์ฌ ์ฌ์ฉ์์๊ฒ ์ ๋ ฅํ ๋ ์๋ด๋ฌธ๊ตฌ๊ฐ ๋์ค๋๋ก ํ ์ ์๋ค.
name = input('์ด๋ฆ์ ์
๋ ฅํ์์ค: ')
๐ ์ถ๋ ฅ
- ์๋ฃํ์ ์ถ๋ ฅ
a = [1,2,3]
print(a) # [1,2,3]
- ํฐ๋ฐ์ดํ(")๋ก ๋๋ฌ์ธ์ธ ๋ฌธ์์ด์ + ์ฐ์ฐ๊ณผ ๋์ผ
print('gone''with''the wind') # gonewiththe wind
print('gone'+'with'+'the wind') # gonewiththe wind
- ์ฝค๋ง๋ ๋์ด์ฐ๊ธฐ๋ฅผ ํ๋ค.
print('gone','with','the wind') # gone with the wind
print('why is the pi value',3.14) # why is the pi value 3.14
- end๋ฅผ ์ด์ฉํด ๋ ๋ฌธ์๋ฅผ ์ง์ ํ ์ ์๋ค.
- end๋ถ๋ถ์ด ์๋ ๊ฒฝ์ฐ '\n' ์ด default ๊ฐ
for i in range(5):
print(i)
# 0
# 1
# 2
# 3
# 4
for i in range(5):
print(i, end=' ')
# 0 1 2 3 4
for i in range(5):
print(i, end='/')
# 0/1/2/3/4/
์ฐธ๊ณ
'Language > Python' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Python] ํด๋์ค (0) | 2022.07.14 |
---|---|
[Python] requests ๋ผ์ด๋ธ๋ฌ๋ฆฌ (0) | 2022.07.10 |
[Python] ๋ด์ฅํจ์ (0) | 2022.06.17 |
[Python] ๊ธฐ๋ณธ ๋ฌธ๋ฒ - ํจ์ (0) | 2022.06.15 |
[Python] ๊ธฐ๋ณธ ๋ฌธ๋ฒ - ์กฐ๊ฑด๋ฌธ, ๋ฐ๋ณต๋ฌธ (0) | 2022.04.30 |