语法错误:Python 2.7 语法无效

0 投票
1 回答
1494 浏览
提问于 2025-04-18 09:11

我是一名新手程序员,最近遇到了一些问题,搞不清楚怎么解决。我在这段代码上出现了一个错误。请注意,我是在Linux系统上(具体来说是树莓派)。

    direct = raw_input("\nPlease give the the directory or your song ending with the file type \nEX. /folder1/favoritesong.WAV"
        #ftype - file type
        #ftype 1 - WAV file
        #ftype 2 - mp3 file
        ftype11 = ".WAV" in direct
        ftype12 = ".wav" in direct
        ftype21 = ".mp3" in direct
        ftype22 = ".MP3" in direct
        if ftype11 or ftype12 == True:
            if ftype11 == True:
                os.system("clear")
                print "Does the song sound to fast, slow, or just not playing at all? Check the README files."
                check1 = os.system("sudo ./pifm " + direct + " " + str(freq) + " 22050 stereo")
                print check1
            elif ftype11 == False:
                if ftype12 == True:
                    os.system("clear")
                    print "Does the song sound to fast, slow, or just not playing at all? Check the README files."
                    check1 = os.system("sudo ./pifm " + direct + " " + str(freq) + " 22050 stereo")
                    print check1
                else:
                    time.sleep(3.5)
                    print "error 256"
                    print error256
                    time.sleep(2)
                    quit()
        elif ftype11 or ftype12 == False:
            if ftype21 == True:
                print good
            elif ftype21 == False:
                if ftype22 == True:
                    print good
                else:
                    time.sleep(3.5)
                    print "error256"
                    print error256
                    time.sleep(2)
                    quit()

如果你需要我完整的代码,这里有,谢谢你提前的帮助。

https://docs.google.com/document/d/1Pjk2MFAKwJzPoFvNXB7DWdrCMEnwnU7Y-oYoKAWcv_0/edit?usp=sharing

1 个回答

1

你在第一行缺少一个闭合的括号。

撰写回答