import csv import sys def csv_to_html_table(csv_file): # CSVファイルを開き、配列に格納する data = [] with open(csv_file, newline='', encoding='utf-8') as f: reader = csv.reader(f) for row in reader: data.append(row) # HTMLコードを生成し、標準出力に書き出す print("") for row in data: print(" ") for cell in row: print(f" ") print(" ") print("
{cell}
") if __name__ == "__main__": if len(sys.argv) != 2: print("Usage: python script.py ") sys.exit(1) csv_file = sys.argv[1] csv_to_html_table(csv_file)