csv出力時の値囲いに関する部分と改行コードが誤っていた部分の修正
This commit is contained in:
parent
abeb325ec5
commit
327ab9da78
@ -206,16 +206,13 @@ def make_csv_data(record_inst: list, record_pharm: list, csv_file_name: str):
|
||||
'UPDATE_USER', 'SYS_REGIST_DATE', 'REGIST_PRGM_ID', 'SYS_UPDATE_DATE', 'UPDATE_PRGM_ID']
|
||||
|
||||
with open(csv_file_path, mode='w', encoding='UTF-8') as csv_file:
|
||||
# ヘッダ行書き込み(くくり文字をつけない為にwriterowではなく、writeを使用しています)
|
||||
csv_file.write(f"{','.join(head_str)}\n")
|
||||
|
||||
# Shift-JIS、CRLF、価囲いありで書き込む
|
||||
writer = csv.writer(csv_file, delimiter=',', lineterminator='\n',
|
||||
quotechar='"', doublequote=True, quoting=csv.QUOTE_ALL,
|
||||
# UTF-8、CRLF、価囲いなしで書き込む
|
||||
writer = csv.writer(csv_file, delimiter=',', lineterminator='\r\n',
|
||||
quoting=csv.QUOTE_NONE,
|
||||
strict=True
|
||||
)
|
||||
|
||||
# データ部分書き込み(施設)
|
||||
writer.writerow(head_str)
|
||||
# データ部分書き込み
|
||||
for record_inst_data in record_inst:
|
||||
record_inst_value = list(record_inst_data.values())
|
||||
csv_data = ['' if n is None else n for n in record_inst_value]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user