![](/img/trans.png)
[英]How to make a command repeat itself inside a python script at certain intervals
[英]How do you make a string repeat itself in python
例如,如何使字符串重复自身:
而不是写print ('---------------------------')
我该如何使其类似于print ('-') * 60
?
你是如此亲密:
>>> print('-' * 60)
------------------------------------------------------------
您需要乘以str
值, 而不是 print()
函数的返回值。
你离我很近-
print "-" * 60
在Python 2中,在Python 3中,
print ("-" * 60)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.