Message203296
| Author |
r.david.murray |
| Recipients |
hynek, ivan.radic, pitrou, r.david.murray, tarek |
| Date |
2013年11月18日.14:42:47 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1384785768.01.0.00248967208673.issue19642@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
See also issue 13229.
You can replicate 'rm -f' like this:
for p in glob.glob('/dir/*'):
os.remove(p)
That doesn't seem worth an extra function.
The annoying one to emulate is 'rm -rf /dir/*', because with the current shutil tools you have to make different calls depending on whether the object is a file or a directory. Pathlib doesn't help with that (it has no generic 'remove' method that applies to both directories and files), but it does make the iteration easier. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2013年11月18日 14:42:48 | r.david.murray | set | recipients:
+ r.david.murray, pitrou, tarek, hynek, ivan.radic |
| 2013年11月18日 14:42:48 | r.david.murray | set | messageid: <1384785768.01.0.00248967208673.issue19642@psf.upfronthosting.co.za> |
| 2013年11月18日 14:42:47 | r.david.murray | link | issue19642 messages |
| 2013年11月18日 14:42:47 | r.david.murray | create |
|