def remove_last_line ( self ) : editor = self . _editor text_cursor = editor . textCursor ( ) text_cursor . movePosition ( text_cursor . End , text_cursor . MoveAnchor ) text_cursor . select ( text_cursor . LineUnderCursor ) text_cursor . removeSelectedText ( ) text_cursor . deletePreviousChar ( ) editor . setTextCursor ( text_cursor )
how to delete previous line on python
Removes the last line of the document .
def remove_last_line(self):
        """Removes the last line of the document."""
        editor = self._editor
        text_cursor = editor.textCursor()
        text_cursor.movePosition(text_cursor.End, text_cursor.MoveAnchor)
        text_cursor.select(text_cursor.LineUnderCursor)
        text_cursor.removeSelectedText()
        text_cursor.deletePreviousChar()
        editor.setTextCursor(text_cursor)