摘要: import os a = [x for x in os.listdir('.') if os.path.isdir(x)] print(a) 这段代码的结果是输出当前目录下的全部子目录(文件夹名字) import os a = [x for x in os.listdir('.') if os.p 阅读全文
posted @ 2020-09-07 15:34 在学同学 阅读(132) 评论(0) 推荐(0)
摘要: map是python内置函数,会根据提供的函数对指定的序列做映射。 map()函数的格式是: map(function,iterable,...) 第一个参数接受一个函数名,后面的参数接受一个或多个可迭代的序列,返回的是一个集合。 把函数依次作用在list中的每一个元素上,得到一个新的list并返回 阅读全文
posted @ 2020-09-07 14:26 在学同学 阅读(1701) 评论(0) 推荐(0)