title: Python: Is there a Walrus Operator for slices of an object?
body: <p>My question is, in all of the walrus examples, they use the whole object for the boolean, <em>e.g.</em></p>
  <pre><code>if (x := len(s)) &gt; 5:
      print(x)
  </code></pre>
  <p>converts</p>
  <pre><code>x = len(s)
  if x &gt; 5:
      print(x)
  </code></pre>
  <p><strong>Is there a way to do it for slices of x, if x were a string?</strong> <em>e.g.</em> <code>x[-1] != ','</code></p>
  <p>Here is code I am looking to convert to walrus operator</p>
  <pre><code>title = book.find(class_='title').get_text()
  if title[-1:] == '\n':
      title = title[:-1]
  </code></pre>