沉冰浮水

沉冰浮水

做最终到的事,成为最终成为的人!
github
bilibili
mastodon
zhihu
douban

"Small Code" Cross-File Line Counting Text "Python"

Description#

A script for personal use, with the following use cases:

Occasionally, exporting a browser plugin's configuration options as a backup, where each file can be seen as a list;

Thinking of counting the number of occurrences of each item in all historical files and then sorting them, and removing those that appear too infrequently from the plugin configuration;

config.json#

You need to prepare a config.json in the same directory as the script to define the configuration options;

{
    "pwd": "Target folder path, absolute address",
    "ext": ".txt | File extension to match",
    "header": "header demo | Write at the beginning of the generated file\n",
    "footer": "\nfooter demo | Write at the end of the generated file",
    "tpl": "#str# #count# Text template for each line",
    "outfile": "Output file path, absolute address, default is \"{pwd}/out{ext}\""
}

Download#

py-statistics-lines · Chen Bingfu/ Shuishui's old code collection - Gitee - Open Source China:

https://gitee.com/wdssmq/StaleCode/tree/master/py-statistics-lines

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.