python - 语法错误 : invalid syntax Python 2. 7

标签 python linux python-2.7 syntax-error raspberry-pi

<分区>

我是一名新手程序员,我似乎无法理解这一点。我输入的这段代码出现错误。请注意,这是在 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

最佳答案

您在第一行缺少一个右括号。

关于python - 语法错误 : invalid syntax Python 2. 7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24127837/

相关文章:

python - 如何在linux命令行中运行sh文件

linux - 在 bash 中比较整数和 float

linux - Bash:使用 ls 、 awk 和 grep 列出文件大小

python - Pygame帮助2.7

python - 在 ipython 解释器中执行文件

python - IBAN 掩码的正则表达式

python - 使用 python 2 和 smtplib 发送电子邮件时出现错误

python - shutil.move() 和 copy() 的问题

python - csv python 中的 Unicode 编码错误

python - 为什么 iter 不是实例的方法而 __iter__ 是?