相关疑难解决方法(0)

如何在函数中键入提示文件名?

Python 中提示文件名的最佳方法是什么,以便将任何内容传递给您可以作为文件打开的函数?

尤其是通过 Pathlib 找到的字符串和文件。

def myfunc(filename: str) -> None:
    with open(filename) as f1:
        # do something here
Run Code Online (Sandbox Code Playgroud)

python type-hinting python-3.x

22
推荐指数
4
解决办法
4633
查看次数

标签 统计

python ×1

python-3.x ×1

type-hinting ×1