- What can I write here to when I pressed the button, delete all blank lines in QTextEdit
 - How can I do this:
 
text in TextEditor:
Hello
Goodbye
Jack
Max
now when I pressed the button insert 12 after or before:
Hello12
Goodbye12
Jack12
Max12
Code:
from PyQt5.QtWidgets import (QPushButton,QApplication,QWidget,QTextEdit,QVBoxLayout)
import sys
class MyApp(QWidget):
    def __init__ (self):
        super().__init__()
        self.initUI()
    def initUI(self):
        self.btn = QPushButton('MyFirstButton',self)
        self.vbox = QVBoxLayout(self)
        self.txt_ed = QTextEdit(self)
        self.vbox.addWidget(self.txt_ed)
        self.vbox.addWidget(self.btn)
        self.btn.clicked.connect(self.btn_func)
        self.setGeometry(300,300,300,450)
        self.setWindowTitle('MyTextApp')
        self.show()
    def btn_func(self):
        pass
        #? 1-What can I write here to when I pressed the button , delete all blank lines in QTextEdit
        #? 2. How can I do this:
        #text in TextEditor:
        #Hello
        #Goodbye
        #Jack
        #Max
        #-----------------------------
        #now when I pressed the button:
        #Hello12
        #Goodbye12
        #Jack12
        #Max12
        #-----------------------------
        #insert 12 after or before.
if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = MyApp()
    sys.exit(app.exec_())