谷歌Colab。IPython.display-音频在if语句中不工作

谷歌Colab。IPython.display-音频在if语句中不工作,python,audio,google-colaboratory,Python,Audio,Google Colaboratory,刚开始学习Python。我在if语句中遇到了一种奇怪的音频行为。它应该会起作用,但不起作用 请参见此处的示例: 此代码工作正常(播放wav文件): 这不是: from IPython.display import Audio sound_boo = "http://mrclan.com/fastdl/tfc/sound/boo.wav" s = 1 if s == 1: Audio(sound_boo, autoplay=True) # dose not play

刚开始学习Python。我在
if
语句中遇到了一种奇怪的音频行为。它应该会起作用,但不起作用

请参见此处的示例:

此代码工作正常(播放wav文件):

这不是:

from IPython.display import Audio

sound_boo = "http://mrclan.com/fastdl/tfc/sound/boo.wav"

s = 1

if s == 1:
  Audio(sound_boo, autoplay=True)  # dose not play...
这里

从IPython.display导入音频,显示
声音_boo=”http://mrclan.com/fastdl/tfc/sound/boo.wav"
s=1
如果s==1:
显示(音频(声音_boo,自动播放=真))
from IPython.display import Audio

sound_boo = "http://mrclan.com/fastdl/tfc/sound/boo.wav"

s = 1

if s == 1:
  Audio(sound_boo, autoplay=True)  # dose not play...