跳转到主要内容

Python工具,用于在文件中更改或替换文本字符串。

项目描述

pypi version build status

这是一个简单的Python工具,用于在文件中更改或替换文本字符串。对于程序员来说,如果他们想替换/更改多个文件的代码,例如函数变量等,这是一个很好的工具,无论是递归文件还是非递归文件。

安装

从PyPI安装

$ pip install changewords

用法

usage: changewords.py [-h] [-p PATH] [-ft FILE_TYPE] [-fs FROM_STRING]
                      [-ts TO_STRING]

Python tool to change or replace the strings in files.

optional arguments:
  -h, --help            show this help message and exit
  -p PATH, --path PATH  the starting path or parent path name
                        by default is current path/folder.
  -ft FILE_TYPE, --file_type FILE_TYPE
                        file type you are looking for, eg: '.py', '.txt'
                        by default is '.py' (python files)
  -fs FROM_STRING, --from_string FROM_STRING
                        the string to change/replace
  -ts TO_STRING, --to_string TO_STRING
                        the string replacement

示例

$ changewords -p=changewords_test -ft=.py -fs=helloworld -ts=mantabjiwa

# or

$ changewords --path=changewords_test --file_type=.py --from_string=helloworld --to_string=mantabjiwa

运行测试

要运行测试,请使用

$ python tests.py

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分发

changewords-1.0.3.tar.gz (3.8 kB 查看哈希值)

上传于

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页