One line for loop with check and raise exception in Python

后端 未结 0 1402
感情败类
感情败类 2021-01-13 20:30

Is there a way to transform a code like:

total_size = 0
for file in files:
  if file.size > 1024:
    raise Exception("file too long")
  total_si         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题