12.08.20 18:53, MRAB пише: > I would suggest: > >>>> while s[ : 1] in {'"', "'"} and s[ : 1] == s[-1 : ]: > ... s = s[1 : -1] And the condition can be written as s[ : 1] == s[-1 : ] in {'"', "'"} or more efficiently as s and s[0] == s[-1] in '\'"'