Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在变量后面打印标点符号?python_Python_String_Printing_Punctuation - Fatal编程技术网

如何在变量后面打印标点符号?python

如何在变量后面打印标点符号?python,python,string,printing,punctuation,Python,String,Printing,Punctuation,我应该 我旁边有一个冒号: 但我想得到 s = "A Colon is beside me" print s,":" 如何连接?连接字符串: >>>A Colon is beside me: 或使用字符串格式: print s + ':' 在python 3上,还可以告诉print函数在多个参数之间使用空分隔符,而不是空格: print '{0}:'.format(s) 连接字符串: >>>A Colon is beside me: 或使用字符串格式

我应该

我旁边有一个冒号:

但我想得到

s = "A Colon is beside me"
print s,":"

如何连接?

连接字符串:

>>>A Colon is beside me:
或使用字符串格式:

print s + ':'
在python 3上,还可以告诉print函数在多个参数之间使用空分隔符,而不是空格:

print '{0}:'.format(s)

连接字符串:

>>>A Colon is beside me:
或使用字符串格式:

print s + ':'
在python 3上,还可以告诉print函数在多个参数之间使用空分隔符,而不是空格:

print '{0}:'.format(s)

这确实有效。我是新到的网站,我把正常的文字不是代码

print(s, ':', sep='')

%s表示在此处插入一个变量,第二个s表示插入特定变量的

此定义有效。我是新到的网站,我把正常的文字不是代码

print(s, ':', sep='')

%s表示在此处插入变量,第二个s表示插入特定变量的

这是为了汇总

打印对账单有四种方式:

我旁边有一个冒号

数据类型解析模式:

打印%s:%s

变量串联模式:

打印+:

格式方法:

打印{}:。格式

使用内置功能:


打印“:”,sep=

这是为了汇总

打印对账单有四种方式:

我旁边有一个冒号

数据类型解析模式:

打印%s:%s

变量串联模式:

打印+:

格式方法:

打印{}:。格式

使用内置功能:


打印“:”,sep=

那不就是你的打断者吗?那不就是你的打断者吗?