Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Commit

Permalink
Fix messy code error
Browse files Browse the repository at this point in the history
Issue: #38
  • Loading branch information
jiajunsu committed Feb 19, 2019
1 parent 2395018 commit d6b1bf4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions calculator_of_Onmyoji/result_combination.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-

import codecs
import csv
from itertools import combinations
from math import factorial
Expand Down Expand Up @@ -73,8 +74,11 @@ class ResultBookCSV(object):

def __init__(self, filename, postfix):
self.postfix = str(postfix)
self.filename = filename[:-4] + '_' + self.postfix + '.csv'
self.write_book = open(self.filename, 'w',
self.filename = filename[:-4] + '-comb_' + self.postfix + '.csv'
# Avoid messy code in win platform
with open(self.filename, 'wb') as fd:
fd.write(codecs.BOM_UTF8)
self.write_book = open(self.filename, 'a',
newline='', encoding='utf-8')
self.writer = csv.DictWriter(self.write_book,
data_format.RESULT_COMB_HEADER)
Expand Down

0 comments on commit d6b1bf4

Please sign in to comment.