运行时,Azure DataBricks抛出此错误:
import re
# ...
class MyApp(QWidget):
# ...
def btn_func(self):
original = self.txt_ed.toPlainText().split('\n')
# https://stackoverflow.com/a/3711884
filtered = filter(lambda x: not re.match(r'^\s*$', x), original)
self.txt_ed.setPlainText("\n".join(filtered))
def btn_func(self):
lines = self.txt_ed.toPlainText().split('\n')
word = "12"
new_lines = [text + word for text in lines]
self.txt_ed.setPlainText("\n".join(new_lines))