Flower in my dev/Python

<PYTHON>[문자열]

꽃선생 2015. 6. 3. 11:10

 

 

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
In [1]: "Flower in my heart".upper()
Out[1]: 'FLOWER IN MY HEART'
 
In [2]: "Flower in my heart".lower()
Out[2]: 'flower in my heart'
 
In [3]: "flower in my heart".capitalize()
Out[3]: 'Flower in my heart'
 
In [4]: "Flower in my heart".title()
Out[4]: 'Flower In My Heart'
 
In [5]: "Flower In My Heart".count('e')
Out[5]: 2
 
In [6]: "Flower In My Heart".find('In')
Out[6]: 7
 
In [7]: "Flower In My Heart".find('Love')
Out[7]: -1
 
In [8]: "Flower In My Heart".startswith('Flower')
Out[8]: True
 
In [9]: "Flower In My Heart".startswith('In')
Out[9]: False
 
In [10]: "Flower In My Heart".endswith('Heart')
Out[10]: True
 
In [11]: "Flower In My Heart".endswith('In')
Out[11]: False
 
In [12]: "  Flower In My Heart  ".strip()
Out[12]: 'Flower In My Heart'
 
In [13]: "  Flower In My Heart  ".rstrip()
Out[13]: '  Flower In My Heart'
 
In [14]: "  Flower In My Heart  ".lstrip()
Out[14]: 'Flower In My Heart  '
 
In [15]: "  Flower In My Heart  ".replace('Flower''Star')
Out[15]: '  Star In My Heart  '
 
In [16]: "Flower In My Heart".split()
Out[16]: ['Flower''In''My''Heart']
 
In [17]: s = "Flower In My Heart".split()
 
In [18]: '/'.join(s)
Out[18]: 'Flower/In/My/Heart'
cs

 

 

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
In [1]: "123".isdigit()
Out[1]: True
 
In [2]: "flower".isalpha()
Out[2]: True
 
In [3]: "123flower".isalnum()
Out[3]: True
 
In [4]: "flower".islower()
Out[4]: True
 
In [5]: "Flower".islower()
Out[5]: False
 
In [6]: "FLOWER".isupper()
Out[6]: True
 
In [7]: "Flower".isupper()
Out[7]: False
 
In [8]: "123".zfill(8)
Out[8]: '00000123'
 
In [9]: "Flower".zfill(8)
Out[9]: '00Flower'
 
In [10]: len('Flower In My Heart')
Out[10]: 18
 
In [11]: ord('F')
Out[11]: 70
 
In [12]: chr(70)
Out[12]: 'F'
 
cs