如您所见,ifinner 是一个字符串,所以如果我只写在 if 之后,总是为真。我能做什么,将它与源代码协调一致?
x=2
ifinner = "x==3"
if ifinner:
print("Yeah")
else:
print("It works!")
Run Code Online (Sandbox Code Playgroud) 我试过这个,但它只是一个空行:
import os
a=300
b=2000
os.system('play --no-show-progress --null --channels 1 synth %s sine %f' % ( a, b))
Run Code Online (Sandbox Code Playgroud)