python中变量输入的语法无效

2024-04-25 16:45:56 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在编写一个程序来提供IPs信息。当我试图通过input获取IP并运行它时,它看起来是SyntaxError: invalid syntax,它只允许我在上面加上字符串。这是我的密码:

 def _get_ip():
    ip = ''

    _get_ = input('What\'s the IP?: {}'.format(ip))

_get_ip()

Tags: the字符串程序ip信息密码inputget