How can I make the efficent for loop in Python?

后端 未结 3 373
自闭症患者
自闭症患者 2021-01-29 16:34

I am writing the csv file in python and there are four levels of nested objects. like

I need to show the csv like this

StudentName, StudentCla

3条回答
  •  悲&欢浪女
    2021-01-29 17:33

    You should Initialize s.subjects and subject.books with empty lists. That way you won't get an error when trying to iterate them here or on other places in your code.

提交回复
热议问题