Python 3.11.2 (tags/v3.11.2:878ead1, Feb 7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>> (s = input(‘练习1,请输入一个任意字符串:’)) != ‘quit’
File “<stdin>”, line 1
(s = input(‘练习1,请输入一个任意字符串:’)) != ‘quit’
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant ‘==’ or ‘:=’ instead of ‘=’?
>>> (s := input(‘练习1,请输入一个任意字符串:’)) != ‘quit’
练习1,请输入一个任意字符串:tttt
True
>>> (s := input(‘练习1,请输入一个任意字符串:’)) != ‘quit’
练习1,请输入一个任意字符串:hgiehgioe
True
>>> (s := input(‘练习1,请输入一个任意字符串:’)) != ‘quit’
练习1,请输入一个任意字符串:quit
False
>>>
KeyboardInterrupt
>>> s := ‘ok?’
File “<stdin>”, line 1
s := ‘ok?’
^^
SyntaxError: invalid syntax
>>>
好像在Python文档中没有找到有关“:=”赋值符的描述。只是根据解释器提示进行尝试。