【发布时间】:2021-08-07 02:39:11
【问题描述】:
请有人帮助我! 我正在尝试制作一个简单的程序,用户可以在其中将字符串插入到已经存在的字符串中(对不起,如果这令人困惑!)
这是我的代码:
firststring = input("enter a string: ")
secondstring = input("enter a second string: ")
position = input("where would you like to place the second string?")
if possition.isdigit == True:
print() <--#help me here
有人可以帮帮我吗?
【问题讨论】:
-
你不能在另一个字符串中插入一个字符串,因为字符串是不可变的。您需要根据位置获取字符串切片并将它们连接起来。
标签: python string input insert