الفرق بين المراجعتين لصفحة: «Python/pathlib/Path/symlink to»
أنشأ الصفحة ب'== التابع Path.cwd == يعيد كائن مسار جديدًا يمثّل المسار الحالي (بشكل مشابه للتابع os.getcwd)<syntaxhighlight lan...' |
|||
سطر 1: | سطر 1: | ||
== التابع Path. | == التابع Path.symlink_to == | ||
Make this path a symbolic link to target. Under Windows, target_is_directory must be true (default False) if the link’s target is a directory. Under POSIX, target_is_directory’s value is ignored.<syntaxhighlight lang="python3"> | |||
>>> Path | >>> p = Path('mylink') | ||
>>> p.symlink_to('setup.py') | |||
>>> p.resolve() | |||
PosixPath('/home/antoine/pathlib/setup.py') | |||
</syntaxhighlight><span> </span> | >>> p.stat().st_size | ||
956 | |||
>>> p.lstat().st_size | |||
8 | |||
</syntaxhighlight>Note | |||
<span> </span> | |||
The order of arguments (link, target) is the reverse of os.symlink()’s. | |||
<span> </span> |
مراجعة 07:47، 3 أغسطس 2018
التابع Path.symlink_to
Make this path a symbolic link to target. Under Windows, target_is_directory must be true (default False) if the link’s target is a directory. Under POSIX, target_is_directory’s value is ignored.
>>> p = Path('mylink')
>>> p.symlink_to('setup.py')
>>> p.resolve()
PosixPath('/home/antoine/pathlib/setup.py')
>>> p.stat().st_size
956
>>> p.lstat().st_size
8
Note
The order of arguments (link, target) is the reverse of os.symlink()’s.