Skip to content

Commit c3a4f21

Browse files
author
guozhen3
committed
v3-format
1 parent e9e6c3b commit c3a4f21

1 file changed

Lines changed: 32 additions & 38 deletions

File tree

README.md

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
#### 2 元素都为真
4141

42-
接受一个可迭代对象,如果可迭代对象的**所有元素**都为真,那么返回 `True`,否则返回`False`
42+
接受一个可迭代对象,如果可迭代对象的所有元素都为真,那么返回 `True`,否则返回`False`
4343

4444
有0,所以不是所有元素都为真
4545
```python
@@ -55,7 +55,7 @@ True
5555

5656
#### 3 元素至少一个为真 
5757

58-
接受一个可迭代对象,如果可迭代对象里**至少有一个**元素为真,那么返回`True`,否则返回`False`
58+
接受一个可迭代对象,如果可迭代对象里至少有一个元素为真,那么返回`True`,否则返回`False`
5959

6060
没有一个元素为真
6161
```python
@@ -70,89 +70,83 @@ True
7070

7171
#### 4 ascii展示对象  
7272

73-
调用对象的 \__repr__ 方法,获得该方法的返回值,如下例子返回值为字符串
73+
调用对象的 `__repr__` 方法,获得该方法的返回值,如下例子返回值为字符串
7474

7575
```python
76-
class Student():
76+
>>> class Student():
7777
def __init__(self,id,name):
7878
self.id = id
7979
self.name = name
8080
def __repr__(self):
8181
return 'id = '+self.id +', name = '+self.name
8282
```
83-
83+
调用:
8484
```python
85-
In [2]: xiaoming = Student(id='1',name='xiaoming')
86-
87-
In [3]: print(xiaoming)
85+
>>> xiaoming = Student(id='1',name='xiaoming')
86+
>>> xiaoming
8887
id = 1, name = xiaoming
89-
90-
In [4]: ascii(xiaoming)
91-
Out[4]: 'id = 001, name = xiaoming'
88+
>>> ascii(xiaoming)
89+
'id = 1, name = xiaoming'
9290
```
9391

9492
#### 5 十转二
9593

96-
`十进制`转换为`二进制`
94+
将十进制转换为二进制:
9795

9896
```python
99-
In [1]: bin(10)
100-
Out[1]: '0b1010'
97+
>>> bin(10)
98+
'0b1010'
10199
```
102100

103101
#### 6 十转八
104102

105-
`十进制`转换为`八进制`
103+
十进制转换为八进制:
106104

107105
```python
108-
In [1]: oct(9)
109-
Out[1]: '0o11'
106+
>>> oct(9)
107+
'0o11'
110108
```
111109

112110
#### 7 十转十六
113111

114-
`十进制`转换为`十六进制`
112+
十进制转换为十六进制:
115113

116114
```python
117-
In [1]: hex(15)
118-
Out[1]: '0xf'
115+
>>> hex(15)
116+
'0xf'
119117
```
120118

121119
#### 8 判断是真是假  
122120

123121
测试一个对象是True, 还是False.
124122

125123
```python
126-
In [1]: bool([0,0,0])
127-
Out[1]: True
128-
129-
In [2]: bool([])
130-
Out[2]: False
131-
132-
In [3]: bool([1,0,1])
133-
Out[3]: True
124+
>>> bool([0,0,0])
125+
True
126+
>>> bool([])
127+
False
128+
>>> bool([1,0,1])
129+
True
134130
```
135131

136132
#### 9 字符串转字节  
137133

138-
将一个`字符串`转换成`字节`类型
134+
字符串转换为字节类型
139135

140136
```python
141-
In [1]: s = "apple"
142-
143-
In [2]: bytes(s,encoding='utf-8')
144-
Out[2]: b'apple'
137+
>>> s = "apple"
138+
>>> bytes(s,encoding='utf-8')
139+
b'apple'
145140
```
146141

147142
#### 10 转为字符串  
148143

149-
`字符类型``数值类型`等转换为`字符串`类型
144+
字符类型、数值型等转换为字符串类型
150145

151146
```python
152-
In [1]: i = 100
153-
154-
In [2]: str(i)
155-
Out[2]: '100'
147+
>>> i = 100
148+
>>> str(i)
149+
'100'
156150
```
157151

158152
#### 11 是否可调用  

0 commit comments

Comments
 (0)