i am using the pyqt5 module and its throwing a indent error here is the bit of code that's throwing the error
i have tried to place the block after the text browser variable
from PyQt5 import QtCore, QtGui, QtWidgets
with open("data.txt", "a+") as data_file:
try:
for text in data_file:
textBrowser.append(text)
else:
for texts in data_file:
textBrowser.append(texts)`
I'm not sure about your indentation but the correct form of try-else IMO is try-except-else. Like this:
try:
...
except Exception:
...
else:
...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.