在python中我试图接受来自用户的输入并连接字符串,但是它给出了无效的语法错误
devicename = raw_input("Please enter devicename: ")
ip = raw_input("Please enter ip ")
print "create ltm node ", devicename, "address ", ip
答案 0 :(得分:2)
我在设备名称后错过了逗号。该行应该读取print“create ltm node”,devicename,“address”,ip
答案 1 :(得分:0)
一种选择是与 + 标记连接,如下所示:
print "create ltm node "+devicename+"address "+ip
答案 2 :(得分:0)
print“create ltm node”,devicename,“address”,ip
你在devicename之后错过了一个逗号