我正在尝试使用多个字符串将短语变量输出到终端。我正在尝试用另一个字符串替换一个字符串。
我不知道如何尝试确保代码可以串联。
setter
我得到的错误是:
firstName = "jason", "jennifer"
LastName = "Maraz", "Lopez"
actor = firstName[0], LastName[0]
actress = firstName[1], LastName[1]
introduceActor= "hi my name is ".join(actor)
print (actor, actress)
s = "lucky"
t = "happy", "greatful", "nice"
phrase = "I am so " + str(s) + " see " + actor + " today. I am as " + str(s) + " as could be"
phrase = phrase.replace(str(s), str(t[1]))
phrase2 = introduceActor
print(phrase)
print(phrase2)
index = phrase.find("i")
print(index)
答案 0 :(得分:1)
您的“演员”和“女演员”是元组,每个元组包含2个字符串。
出于您的目的,您可能应该使用:
Formula1:="=$D" & CStr(r)
这样,您将拥有字符串而不是元组。 Check here for more information