Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.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 Regex在多个字符串之间添加间距_Python_Regex - Fatal编程技术网

Python Regex在多个字符串之间添加间距

Python Regex在多个字符串之间添加间距,python,regex,Python,Regex,我想表示: print('{:<16s}{:>16s}{:>16s}{:>16s}{:>16s}{:>16s}'.format('Id', 'Loan Amount', 'Country Name', 'Status', 'Time to Raise', 'Total Number of Lenders')) 谢谢您的时间。您可以通过执行“xxx”*5将同一个字符串连接多次,并将数字置于外部 print(('{:>16s}' * 5).format(

我想表示:

 print('{:<16s}{:>16s}{:>16s}{:>16s}{:>16s}{:>16s}'.format('Id', 'Loan Amount', 'Country Name', 'Status', 'Time to Raise', 'Total Number of Lenders'))

谢谢您的时间。

您可以通过执行
“xxx”*5
将同一个字符串连接多次,并将数字置于外部

print(('{:>16s}' * 5).format('Id','Loan Amount','Country Name','Status','Time to Raise',
                             'Total Number of Lenders'))

请注意,对于
Id
格式为向右拉,第一个给定的确切对应如下所示

print(('{:<16s}' + '{:>16s}' * 5).format('Id', 'Loan Amount', 'Country Name', 'Status', 
                                         'Time to Raise','Total Number of Lenders'))
print(('{:16s}'*5).格式('Id','Loan Amount','Country Name','Status',',
“融资时间”、“贷款人总数”))
print(('{:<16s}' + '{:>16s}' * 5).format('Id', 'Loan Amount', 'Country Name', 'Status', 
                                         'Time to Raise','Total Number of Lenders'))