Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要知道如何使用 python 集列出 linux 文件系统的 /etc/passwd 文件中列出的所有唯一 shell。这将从命令行在 python shell 中执行。
最简单的方法:
import pwd shells = set(p.pw_shell for p in pwd.getpwall()) print('\n'.join(shells))