Aug-08-2022, 10:18 AM
How does the data look. You wrote that you want to remove
The naive answer without thinking long about this:
But this will remove all white spaces from left and right.
Post some example data.
[
and ]
. This is not exact enough.The naive answer without thinking long about this:
line.lstrip().removeprefix("[")
and line.rstrip().removesuffix("]")
.But this will remove all white spaces from left and right.
- Are white spaces before
[
?
- Are white spaces after
]
?
- Keeping white spaces on the right side?
- What if the line starts with
[[
? Are there any special cases?
Post some example data.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!