-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpython_basic_jm_01.py
More file actions
83 lines (49 loc) · 1.38 KB
/
python_basic_jm_01.py
File metadata and controls
83 lines (49 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# python basic jm 01
'''
print의 이해
'''
# 기본출력
print('Hellow python!')
print("Hellow python!")
print("""Hellow python!""")
print('''Hellow python!''')
print()
# Separator 옵션 사용
print('T','E','S','T')
print('T','E','S','T', sep='')
print()
print('jmkim','naver.com')
print('jmkim','naver.com',sep='@')
# end 옵션 사용
print('hi, my name')
print('is Jaemin Kim. What')
print('your name?')
print()
print('hi, my name',end=' ')
print('is Jaemin Kim. What',end=' ')
print('your name?',end=' ')
# format사용 [], {}, ()
print('{} and {}'.format('You', 'Me'))
print('{0} and {1} and {0}'.format('You', 'Me')) # 숫자 인덱싱
print('{a} and {b} and {c}'.format(a='Kim', b='Lee', c='Jung'))
# %s(문자), %d(정수), %f(실수)
print('%s is handsome and kindman' % ('Jaemin'))
print('My height is %dcm' % (177))
print('My weight is %fkg' % (68.3))
# %3d: 정수 3번째자리까지만 출력, %3.2f는 정수는 3번째짜리까지만 소수자리는 2번째 자리까지만 출력
print('integer: %3d, float: %3.2f' % (12345, 12345.1234))
print('integer:{0: 3d}, float:{1: 3.2f}'.format(12345, 12345.1234))
print('integer:{a: 3d}, float:{b: 3.2f}'.format(a=12345, b=12345.1234))
"""
참고 : Escape 코드
\n : 개행
\t : 탭
\\ : 문자
\' : 문자
\" : 문자
\r : 캐리지 리턴
\f : 폼 피드
\a : 벨 소리
\b : 백 스페이스
\000 : 널 문자
"""