Open Elijas opened 1 year ago
Just a simple terminal command would suffice
new_version="0.1.2" sed -i "s/^\(version[[:space:]]*=[[:space:]]*\).*$/\1 ${new_version}/" settings.ini
or in python
import re new_version = "0.1.2" with open("settings.ini", "r") as file: content = file.read() content = re.sub(r"^(version\s*=\s*).*?$", r"\1 " + new_version, content, flags=re.MULTILINE) with open("settings.ini", "w") as file: file.write(content)
Reproduction
Solution
Just a simple terminal command would suffice
or in python