Using name of strings in different functions

后端 未结 3 1354
旧巷少年郎
旧巷少年郎 2021-01-24 22:57

I need to use movies_list from the first function in the second. How do I do that?

def movie():
    movies_list = [movie.strip() for movie in movies         


        
3条回答
  •  广开言路
    2021-01-24 23:40

    Make the second function nested on the first one, here you have an example:

    def hello():
        a = "hello"
        def world():
            return "%s world" % a
        return world()
    print hello()
    

提交回复
热议问题