Add files via upload

Init
This commit is contained in:
Joe Küng
2024-07-03 14:45:58 +02:00
committed by GitHub
parent ca146db7c1
commit a12f43b98a
2 changed files with 79 additions and 0 deletions

28
properties-to-csv.py Normal file
View File

@@ -0,0 +1,28 @@
import csv
import os
def convert_properties_to_excel(input_file):
csv_filepath = 'temp.csv'
with open(input_file, 'r', encoding='utf-8') as prop_file, \
open(csv_filepath, 'w', newline='', encoding='utf-8') as csv_file:
writer = csv.writer(csv_file, delimiter=';')
writer.writerow(['Chiave', 'Valore'])
for line in prop_file:
line = line.strip()
if line and not line.startswith('#'):
key, value = line.split('=', 1)
writer.writerow([key, value])
os.system(f'start excel "{csv_filepath}"')
input("Press Enter after saving the file")
os.remove(csv_filepath)
if __name__ == '__main__':
input_file = 'C:\\work\\project\\opc\\hybris\\bin\\custom\\opc\\opccore\\resources\\localization\\opccore-locales_en.properties'
convert_properties_to_excel(input_file)