我的第一个问题,请温柔。我搜索但无法在此处或其他地方找到答案。
请注意,此问题不适用于解包 *args 之类的参数。
在os.removexattr的 python 3.3 文档中,声明如下:
os.removexattr(path, attribute, *, follow_symlinks=True)
Removes the extended filesystem attribute attribute from path.
attribute should be bytes or str. If it is a string, it is encoded
with the filesystem encoding.
This function can support specifying a file descriptor and not
following symlinks.
Run Code Online (Sandbox Code Playgroud)
请注意,第三个参数是一个星号:*
我认为这意味着“指定一个或多个用逗号分隔的属性”,但是在尝试执行此操作时,出现异常:
import os
os.removexattr('M7-AAE-01.jpg', 'user.camera_brand', 'user.camera_model')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Function takes at most 2 positional arguments …Run Code Online (Sandbox Code Playgroud)