gpt4 book ai didi

python - python中&\是什么意思

转载 作者:太空宇宙 更新时间:2023-11-03 19:45:13 25 4
gpt4 key购买 nike

我发现了下面的代码,

period=volume[((volume['Id']==report.at[report.index[report_id],'id']) & \
(volume['Time']>=start_time) & \
(volume['Time']<=test_time))]

我读了一篇关于 operator & 的帖子但是 &\ 是什么意思以及这段代码是做什么的?

最佳答案

反斜杠不会与 & 创建另一个运算符,它只是用于允许一个长语句继续到下一行以提高可读性。所以代码相当于

period=volume[((volume['Id']==report.at[report.index[report_id],'id']) & (volume['Time']>=start_time) & (volume['Time']<=test_time))]

关于python - python中&\是什么意思,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60180508/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com