Python return list from function

后端 未结 8 875
面向向阳花
面向向阳花 2020-12-13 08:27

I have a function that parses a file into a list. I\'m trying to return that list so I can use it in other functions.

def splitNet():
    network = []
    f         


        
8条回答
  •  时光说笑
    2020-12-13 09:03

    Variables cannot be accessed outside the scope of a function they were defined in.

    Simply do this:

    network = splitNet()
    print network
    

提交回复
热议问题