Skip to content

Commit f0769f4

Browse files
author
guozhen3
committed
Merge branch 'temp'
2 parents 78f6f4c + 6a9cd29 commit f0769f4

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,19 @@ True
8181
调用对象的 \__repr__ 方法,获得该方法的返回值,如下例子返回值为字符串
8282

8383
```python
84-
In [1]: class Student():
85-
...: def __init__(self,id,name):
86-
...: self.id = id
87-
...: self.name = name
88-
...: def __repr__(self):
89-
...: return 'id = '+self.id +', name = '+self.name
90-
...:
91-
...:
84+
class Student():
85+
def __init__(self,id,name):
86+
self.id = id
87+
self.name = name
88+
def __repr__(self):
89+
return 'id = '+self.id +', name = '+self.name
90+
```
9291

93-
In [2]: xiaoming = Student(id='001',name='xiaoming')
92+
```python
93+
In [2]: xiaoming = Student(id='1',name='xiaoming')
9494

9595
In [3]: print(xiaoming)
96-
id = 001, name = xiaoming
96+
id = 1, name = xiaoming
9797

9898
In [4]: ascii(xiaoming)
9999
Out[4]: 'id = 001, name = xiaoming'

0 commit comments

Comments
 (0)