将两个字符串放在Python的页面中心上
我想在页面中心放置两个字符串,“您的名字”和“名称变量”,但我尝试使用.center(165)
and rjust(165 // 2)< /code>命令,但似乎不起作用。 我的代码:
name=input("your name :".rjust(165//2))
print("your name is " + name).rjust(165//2)
这无效
我的期望结果:
Your name: example
Your name is example
I wanted to place the two strings, "Your name is " and name variable in the center of the page but I tried using .center(165)
and rjust(165//2)
commands but does not seem to work.
My code:
name=input("your name :".rjust(165//2))
print("your name is " + name).rjust(165//2)
which does not work
what my desired outcome:
Your name: example
Your name is example
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)