PyCharm Edu 4.0 Help

Surrounding Blocks of Code with Language Constructs

Applicable contexts

The Surround with feature (Code | Surround with or Ctrl+Alt+T) lets you put expressions or statements within blocks or language constructs. This feature in PyCharm Edu applies to:

ContextSurround withExample
  • Tag
  • CDATA section
  • <% ... %>
  • Emmet
Python statements
  • if
  • while
  • try/except
  • try/finally

Surrounding blocks of code

To surround a block of code

  1. Select the desired code fragment.
  2. Press Ctrl+Alt+T.

    A pop-up window displays the list of enclosing statements according to the context.

  3. Select the desired surround statement from the list. To do that, use the mouse cursor, up and down arrow keys, or a shortcut key displayed next to each element of the list.
Last modified: 15 December 2017