這是怎麼回事? (我只是一個初學者,所以沒有什麼複雜的,拜託了!)縮進問題! (Python 2.7)
#!usr/bin/python
import os
import sys
import pdb
import time
import array
red = chr(00), chr(00), chr(255)
blue = chr(255), chr(00), chr(00)
print "Monochrome Bitmap Color Changer"
print "Supported colors: "
print "Black, White, Blue, Red, Yellow,"
print "Green, Orange, Purple, Pink, Brown, Grey"
print ""
filename = raw_input("Please enter filename or directory of monochrome bitmap: ")
whitevalue = raw_input("Change all white pixels to? ")
blackvalue = raw_input("Change all black pixels to? ")
with open (filename, 'r+b') as f:
f.seek(54)
if whitevalue is "red" or "Red":
f.write(red)
elif whitevalue is "blue" or "Blue":
f.write(blue)
f.seek(58)
if blackvalue is "red" or "Red":
f.write(red)
elif blackvalue is "blue" or "Blue":
f.write(blue)
exit
#print "Done"
#time.sleep(3)
#exit
第二f.write(red)
線後,它顯示了一個紅粉紅色的亮點,並說:
「取消縮進不匹配任何外部縮進級別'
這是什麼意思,以及如何幫助/修復它?
非常感謝!