Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save FGFW/9f07440c27476513cae7 to your computer and use it in GitHub Desktop.
Save FGFW/9f07440c27476513cae7 to your computer and use it in GitHub Desktop.
python获取每个文件的名称和大小.py
"""
python获取每个文件的名称和大小.py
http://bbs.bathome.net/thread-39660-1-1.html
2016年3月12日 23:52:29 codegay
"""
import os
[print(os.path.basename(r),str(os.path.getsize(r))+"我知道你很不爽,你咬我啊") for r in os.listdir(".") if os.path.isfile(r)]
input()
@FGFW
Copy link
Author

FGFW commented Mar 13, 2016

[print(os.path.abspath(r),os.path.getsize(r),"字节") for r in glob.glob("*") if os.path.isfile(r)]

[print(subprocess.getoutput(r"""echo off&for %i in (*.*) do (echo %~nxi %~zi)"""),)]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment