📜  python 重命名 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:16.800000             🧑  作者: Mango

代码示例5
#!/usr/bin/python

import os
# Scan current path='.'
it =  os.scandir()
for entry in it:
    if not entry.name.startswith('.') and entry.is_file():
        print(entry.name)
        os.rename(entry.name, entry.name.replace('_', ''))