file_list = os.listdir(os.getcwd)
files = file_list.sort()
Run Code Online (Sandbox Code Playgroud)
如果我有一个基于上面目录列表的列表,为什么有时候如果使用files.sort()函数返回NoneType但是使用sorted(files)函数返回目标排序?
是否可以迭代多个列表并从同一循环中的不同列表返回参数?
即,而不是 -
For x in trees:
Print(x)
For y in bushes:
Print(y)
Run Code Online (Sandbox Code Playgroud)
就像是 -
For x,y in trees,bushes:
Print(x +"\n"+ y)
Run Code Online (Sandbox Code Playgroud)