Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
如果 key 不是 int 或 float 而是 string,则需要将其转换为 < code>int 首先通过执行
key
int
float
str
key = int(key)
or 到 float 通过执行
key = float(key)
否则,您的问题中的内容应该有效,但
if (key < 1) or (key > 34):
or
if not (1 <= key <= 34):
会更清晰一些。
If key isn't an int or float but a string, you need to convert it to an int first by doing
or to a float by doing
Otherwise, what you have in your question should work, but
would be a bit clearer.
这是一个布尔值:
if (not suffix == "flac" ) or (not suffix == "cue" ): # WRONG! FAILS print filename + ' is not a flac or cue file'
but
if not (suffix == "flac" or suffix == "cue" ): # CORRECT! print filename + ' is not a flac or cue file'
(not a) or (not b) == not ( a and b ) ,仅当 a 和 b 均为 true 时才为 false
(not a) or (not b) == not ( a and b )
不是(a 或 b)仅当 a 和 be 均为假时才为真。
不是(a 或 b)
Here's a Boolean thing:
(not a) or (not b) == not ( a and b ) ,is false only if a and b are both true
not (a or b)is true only if a and be are both false.
not (a or b)
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(2)
如果
key
不是int
或float
而是str
ing,则需要将其转换为 < code>int 首先通过执行or 到
float
通过执行否则,您的问题中的内容应该有效,但
or
会更清晰一些。
If
key
isn't anint
orfloat
but astr
ing, you need to convert it to anint
first by doingor to a
float
by doingOtherwise, what you have in your question should work, but
or
would be a bit clearer.
这是一个布尔值:
but
(not a) or (not b) == not ( a and b )
,仅当 a 和 b 均为 true 时才为 false
不是(a 或 b)
仅当 a 和 be 均为假时才为真。
Here's a Boolean thing:
but
(not a) or (not b) == not ( a and b )
,is false only if a and b are both true
not (a or b)
is true only if a and be are both false.