1. single_quotes

2. 문자열에 single_quotes 사용하는 방법

3. three_quotes

4. 주석

5. 문자열 길이 len()

6. 문자열 범위로 가져오기

7. 문자열을 다루기위한 파이썬 기본 메서드 들?

8. 문자열 format

 

문자열을 다루기위해 이정도 문법정도는 알고 있어야할것같아서 한번씩은 타이핑을 해보았다. 헿ㅎ

 

 

 

 

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
# single_quotes 
single_quotes  = 'Hello World'
print(single_quotes)
 
#double_quotes
double_quotes = "It's "
print(double_quotes)
 
# three_quotes
three_quotes = """
    three_quotes example
"""
print(three_quotes)
 
#len
string_len = len(single_quotes)
print(string_len)
 
#string Index
index1 = single_quotes[0]
index2 = single_quotes[1]
index3 = single_quotes[2]
index4 = single_quotes[3]
index5 = single_quotes[4]
print(index1)
print(index2)
print(index3)
print(index4)
print(index5)
 
#range index
range1 = single_quotes[0:5]
range2 = single_quotes[:5]
range3 = single_quotes[6:]
print(range1)
print(range2)
print(range3)
 
#python method
print(single_quotes.count('Hello'))
print(single_quotes.find('World'))
print(single_quotes.replace('World','zzzz'))
print(single_quotes)
 
 
greeting = 'Hello'
name = 'kingchobo'
result = greeting + ',' + name
print(result)
 
result1 = '{}, {}. Welcome!'.format(greeting,name)
print(result1)
 
result2 = f'{greeting},{name.upper()} good'
print(result2)
 
 
print(dir(name))
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs

'Python' 카테고리의 다른 글

1. 가상환경 사용하기  (0) 2018.08.07

+ Recent posts