In the python plugin, I'm developing, I need to retrieve the number of selected rows in a QTableWidget. I can loop through each row of the QTableWidget and check them whether it is selected or not. Instead, Is there a straightforward way to get the selected rows count of a QTableWidget in PyQt? 
Something like:

QTableWidget.selectedRowsCount()
len(tablewidget.selectedIndexes()) should probably do what you want.
Getting Selected Rows Count in QTableWidget - PyQt