indent_template
下の方に日本語の説明があります
Overview
- A tool to replace strings without breaking indent.
- description is under construction.
Usage
import indent_template
# String before replacement
template_str = """
def func():
ls = VALUE_HERE
print(str(ls + VALUE_HERE))
"""
# String after replacement
rep_str = """[
"hoge",
"fuga"
]"""
# Replacing strings without breaking indentation [indent_template]
result_str = indent_template.replace(
template_str, # String before replacement
{"VALUE_HERE": rep_str} # Replacement pattern
)
# Result confirmation
print(result_str)
Result
def func():
ls = [
"hoge",
"fuga"
]
print(str(ls + [
"hoge",
"fuga"
]))
概要
- インデントを崩さずに文字列の置き換えが実施できます。
- プログラミング言語やjsonなどをプログラムで出力する際などに便利です。
- 説明は執筆途上です
使用例
import indent_template
# 置き換え元の文字列
template_str = """
def func():
ls = VALUE_HERE
print(str(ls + VALUE_HERE))
"""
# 置き換え後文字列
rep_str = """[
"hoge",
"fuga"
]"""
# インデントを崩さずに文字列を置き換える [indent_template]
result_str = indent_template.replace(
template_str, # 置き換え元の文字列
{"VALUE_HERE": rep_str} # 置き換えパターン
)
# 結果確認
print(result_str)
結果
def func():
ls = [
"hoge",
"fuga"
]
print(str(ls + [
"hoge",
"fuga"
]))
Metadata
Release files for indent-template 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| indent-template-0.0.2.tar.gz | 2.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| indent_template-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.2 kB
Release files / indent-template-0.0.2.tar.gz
| Download URL | indent-template-0.0.2.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
937170b1fd6897263b59a9f177fa146214e8f4772eb3179429ed74010c26bc9c
|
|
BLAKE2b-256 checksum How to use checksums |
30c98c40e7fdf766a53438a747371f5dff65026ee4e106adc704c21e96d3aecb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.3
|
Release files / indent_template-0.0.2-py3-none-any.whl
| Download URL | indent_template-0.0.2-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
21e5b2ce9a0a8b2bb963dd0a56e60bc863adf43272b133bc0e03665ead887fc4
|
|
BLAKE2b-256 checksum How to use checksums |
662785479a9b6cfea9f79b149971f8884c2666211224d3249dfa390ef52f3626
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.3
|
Security for indent-template 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.