stringtable.csv Fix Script
Add double quotes to each cell to adapt to DayZ's CSV format.
Usage: python CSV_Fix.py stringtable.csv
# python CSV_Fix.py stringtable.csv
import sys
import csv
def process_line(line):
reader = csv.reader([line])
fields = next(reader)
return ','.join([f'"{field}"' if not field.startswith('"') else field for field in fields])
def main(input_file, output_file):
with open(input_file, 'r') as infile, open(output_file, 'w') as outfile:
for line in infile:
processed_line = process_line(line)
outfile.write(processed_line + '\n')
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python CSV_Fix.py stringtable.csv")
sys.exit(1)
input_file = sys.argv[1]
output_file = "stringtable_output.csv"
main(input_file, output_file)