code: def get_previous_character(self):
          
  
          cursor = self.textCursor()
          cursor.movePosition(QTextCursor.PreviousCharacter, QTextCursor.KeepAnchor)
          return cursor.selectedText()
docs: Returns the character before the cursor.
  
          :return: Previous cursor character.
          :rtype: QString