Alicia Hernandez-Castillo Programs

This program converts the line list from the log file from PGOPHER into an XIAM format.

import csv

file_path = input(“Input File Path: “)
output_file_name = input(“Output File Name: “)

newCsvData = []

with open(file_path, mode=’r’) as file:
csv_reader = csv.reader(file)
header_row = next(csv_reader)
header_row = next(csv_reader)firstValIndex = header_row.index("Position") secondValIndex = header_row.index("Intensity") # go through csv rows and cols for row in csv_reader: try: newCsvData.append([row[firstValIndex], row[secondValIndex]]) except: pass

with open(output_file_name, mode=”w”, newline=”) as file:
csv_writer = csv.writer(file)
csv_writer.writerows(newCsvData)