SyntaxError:无效语法Python 2.7

2024-10-02 10:24:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我是一个新的程序员,我似乎搞不懂这个。我输入的这段代码出错了。请注意,这是在Linux上实现的(确切地说是Raspberry Pi)。在

    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


Tags: ortheintrueiftimeossleep

热门问题