Python连接一个字符串和一个变量

时间:2016-04-17 00:06:43

标签: string python-2.7 variables string-concatenation

我正在尝试连接字符串和变量,我看到新行添加了..

em

当我尝试打印temp_var时,它会在连接期间添加新行。

with输出应该是这样的:

def convert_hostname(row_rack,ru_host,orig_hostname):
  if orig_hostname[0:9] == "ll21l01ms":
     print row_rack,
     print ru_host,
     temp_var = "ll21l01ls-" + row_rack + ru_host + ".com"
     print temp_var

Output when run :
0707
49
ll21l01ls-0707
49
.com

有什么想法吗?

1 个答案:

答案 0 :(得分:3)

尝试:

prepareForSegue
相关问题