try:
data=open('open_file.txt')
for each_line in data:
try:
(var1,var2)=each_line.split(":",1)
print(var1)
print(var2)
except:
print(each_line)
data.close()
except:
print('File is not existing')
透過Python的try & except,程式碼果真變得很簡潔~