import pathlib, datetime
print("{:30} : {}".format("pathlib.PurePath('.')" , type(pathlib.PurePath("."))))
print("{:30} : {}".format("pathlib.PurePosixPath('.')" , type(pathlib.PurePosixPath("."))))
print("{:30} : {}".format("pathlib.PureWindowsPath('.')" , type(pathlib.PureWindowsPath("."))))
print()
print("{:30} : {}".format("pathlib.Path('.')" , type(pathlib.Path("."))))
#print("{:30} : {}".format("pathlib.PosixPath('.')" , type(pathlib.PosixPath("."))))
print("{:30} : {}".format("pathlib.WindowsPath('.')" , type(pathlib.WindowsPath("."))))
_path = pathlib.Path(".")
print(_path.cwd())
print()
for _dir in _path.iterdir() :
print("{} {:30} {:10} {:20} {}".format("D" if _dir.is_dir() else "F"
, _dir.name
, _dir.stat().st_size
, datetime.datetime.fromtimestamp(_dir.stat().st_mtime).strftime("%Y/%m/%d %H:%M:%S")
, _path.joinpath(_path.absolute(), _dir)))
>>> exec(open("path.py", encoding="utf-8").read())
pathlib.PurePath('.') : <class 'pathlib.PureWindowsPath'>
pathlib.PurePosixPath('.') : <class 'pathlib.PurePosixPath'>
pathlib.PureWindowsPath('.') : <class 'pathlib.PureWindowsPath'>
pathlib.Path('.') : <class 'pathlib.WindowsPath'>
pathlib.WindowsPath('.') : <class 'pathlib.WindowsPath'>
U:\Project\Python
D .git 4096 2019/08/16 02:57:06 U:\Project\Python\.git
F .gitattributes 66 2019/08/16 02:30:04 U:\Project\Python\.gitattributes
F beautifulSoup.py 447 2019/08/31 01:55:15 U:\Project\Python\beautifulSoup.py
F beautifulSoup2.py 1527 2019/08/31 03:48:50 U:\Project\Python\beautifulSoup2.py
F first.py 470 2019/08/18 02:48:31 U:\Project\Python\first.py
F http.py 535 2019/08/30 00:07:49 U:\Project\Python\http.py
F mbox-short.txt 96536 2019/08/23 02:39:07 U:\Project\Python\mbox-short.txt
F path.py 1107 2019/08/31 14:00:34 U:\Project\Python\path.py
F second.py 454 2019/08/18 03:52:42 U:\Project\Python\second.py
F socket.py 652 2019/08/29 00:47:49 U:\Project\Python\socket.py
F string.py 322 2019/08/31 01:52:13 U:\Project\Python\string.py
F third.py 324 2019/08/18 16:46:14 U:\Project\Python\third.py
D __pycache__ 0 2019/08/30 00:17:28 U:\Project\Python\__pycache__
pathlib 디렉토리 탐색
|
2019.08.29 18:45:24
|
2022.10.16 04:24:43
|
404
|
Aiden
Total of Attached file
0.00 Bytes of 0 files
2019.09.03
2019.08.30
2019.08.30
2019.08.30
2019.08.29
2019.08.29
2019.08.28
2019.08.23
2019.08.23
2019.08.21