如何在python中删除来自python的范围对象的生成数字之间的空间,例如stripe()方法,应用于字符串
然后,我如何获得条纹方法的效果,但对整数 这是我要生成的代码,
1
121
12321
1234321
123454321
for i in range(1,int(input())+1):
print(*range(1,i+1),*range(1,i).__reversed__())
Then How I get the Same effect of stripe method but on integers
this is my code to generate out but like
1
121
12321
1234321
123454321
but the result was : i want to remove spaces between numbers in one line code after for statement
for i in range(1,int(input())+1):
print(*range(1,i+1),*range(1,i).__reversed__())
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Python的
打印
具有可选的sep
参数。尽管该
__反向__()
呼叫很丑陋。请注意,还有一个可选的
end
参数。例如,您可能不希望您的打印
自动跳到下一行。Python's
print
has an optionalsep
parameter.Though that
__reversed__()
call is ugly.Please note there is also an optional
end
parameter. You may, for instance, not want yourprint
to automatically skip to the next line.尝试先格式化字符串,然后将其传递给
print
。Try formatting a string first and pass that to
print
.