python - Indentation error : unexpected error -
i new python , have written code in notepad++. have used spaces instead of tab , guess have used correct indentation format. still thie error. dont understand doing wrong. here code,
#!/usr/bin/python import sys import shutil import sys def usage() : print "labelfile transcriptionfile phonemefile" def main(argv = none) : if len(sys.argv) !=3 : usage() else : labelfile = sys.argv[1] transcriptionfile = sys.argv[2] phonemefile = sys.argv[3] if (os.path.exists(labelfile)) : infile = open(labelfile, "r") tfile = open(transcriptionfile, "w") pfile = open(phonemefile, "w") line in iter(infile) : list = line.split() tlist = list.pop(3) plist = list[2] tfile.write(" ".join(list) + "\n") pfile.write("".join(list) + " ") infile.close() tfile.close() pfile.close() if __name__ == "__main__" : sys.exit(main())
please help. thank much.
there indentation in front of
for line in iter(infile) :
reduce indentation line , following 8 lines, , should set.
Comments
Post a Comment