注册 登录
编程论坛 Python论坛

self. 有什么用?

Drunk 发布于 2019-08-19 21:32, 1762 次点击
print('apple','bean',sep=',',end='self.')
   
4 回复
#2
TysonKoothra2019-08-19 21:52
把这条语句粘贴到python命令行,就能看明白了。
程序代码:

>>> print('apple','bean',sep=',',end='self.')
apple,beanself.>>> print('apple','bean')
apple bean

默认end='\n',换成self.之后,打印之后不换行了,补上了self.
#3
Drunk2019-08-19 22:16
谢谢
#4
Drunk2019-08-19 22:17
还有
round(10.67,1)
这个为什么没结果
#5
TysonKoothra2019-08-19 22:20
回复 4楼 Drunk
返回值是10.7,并不是没效果
1