python变量加逗号,的含义
逗号,
用于生成一个长度为1的元组
>>> (1) 1 >>> (1,) (1,) >>> 1, (1,)
因此需要将长度为1的元组中元素提取出来可以用,
简化赋值操作
>>> a=(1,) >>> b=a >>> b (1,) >>> b,=a >>> b 1
最后print
打印变量加,
实现连续打印不换行的操作在python3中行不通了
Python 3.7.3 (default, Nov 15 2019, 04:04:52) [Clang 11.0.0 (clang-1100.0.33.16)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> for i in range(0,5): ... print(i) ... 0 1 2 3 4 >>> for i in range(0,5): ... print(i,) ... 0 1 2 3 4
相关推荐
Erick 2020-11-17
YENCSDN 2020-11-17
lsjweiyi 2020-11-17
houmenghu 2020-11-17
HeyShHeyou 2020-11-17
以梦为马不负韶华 2020-10-20
lhtzbj 2020-11-17
夜斗不是神 2020-11-17
pythonjw 2020-11-17
dingwun 2020-11-16
lhxxhl 2020-11-16
坚持是一种品质 2020-11-16
染血白衣 2020-11-16
huavhuahua 2020-11-20
meylovezn 2020-11-20
逍遥友 2020-11-20
weiiron 2020-11-16