连接功能输出?

时间:2015-10-12 18:42:58

标签: python python-3.x python-3.5

您如何连接headNametailName

name = input("What is your name? ") 
def headName(name):
    print((name)[:1].upper())
def tailName(name):
    print((name)[1:].lower())
headName = str(headName(name))
tailName = str(tailName(name))

1 个答案:

答案 0 :(得分:1)

如果通过连接你的意思是"胶水"两个函数的结果,因为它们是字符串,你可以使用" +"操作

name = input("What is your name? ") def headName(name): return((name)[:1].upper()) def tailName(name): return((name)[1:].lower()) headName = str(headName(name)) tailName = str(tailName(name)) print(headName+tailName)