马老师 发表于 2020-8-30 14:30:31

sep=''是什么意思

print("正面:", heads, "次", sep="")中sep=''有什么用?

1q23w31 发表于 2020-8-30 14:32:53

https://fishc.com.cn/forum.php?mod=viewthread&tid=141463&highlight=print

疾风怪盗 发表于 2020-8-30 14:34:56

先来看下官方解释,
  sep:分割值与值,默认是一个空格
  end:附件到最后一个值,默认是一个新行

打印:#分割值,打印最后是@@加一个空行

print("I'm a tester.","hello python","good",sep='#',end='@@\n')
print('---------------')
print("I'm a tester.","hello python\n","good",sep='#',end='@@\n')
输出结果:
I'm a tester.#hello python#good@@
---------------
I'm a tester.#hello python
#good@@
页: [1]
查看完整版本: sep=''是什么意思