Last active
June 14, 2021 11:13
-
-
Save Abathargh/20dbbc576ebc2911e300db1c9a9aee8f to your computer and use it in GitHub Desktop.
Convert a .env properties file to json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
prop = None | |
with open(sys.argv[1], "r") as f: | |
prop = f.read() | |
res = "{\n" | |
for line in prop.split("\n"): | |
if "=" in line: | |
name, value = line.split("=") | |
res += f'\t"{name}": "{value}",\n' | |
res = res[:-2] | |
res += "\n}" | |
print(res) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment