指定单词之间的空格 [英] Specifying spaces between words

查看:34
本文介绍了指定单词之间的空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何在python中使用空格,我可以指定单词之间的空格的大小

how could I use whitespaces in python that in the could I can specify how mach the space between the words

打印约翰和(5 个空格)马克去了(3 个空格)伦敦"

print "John and (5 spaces) Mark went to (3 spaces) London"

如何指定 5 个空格作为代码而不将其输入为 " "

how could I specify 5 spaces as a code without typing it as " "

推荐答案

你可以试试这个:

space = " "
print "John and{}Mark went to{}London".format(space*5,space*3)

在这里您可以找到更多信息

这篇关于指定单词之间的空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆