-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsaveFile.py
More file actions
33 lines (31 loc) · 895 Bytes
/
saveFile.py
File metadata and controls
33 lines (31 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/env python
# -*-coding:utf-8-*-
class SaveFile(object):
desc_file = 'output/export.sql'
def write_file(self,data_msg_list):
"""
写入文件
:param datas:
:param filename:
:return:
"""
file_object = None
try:
file_object = open(self.desc_file, 'a')
file_object.writelines([line+'\n' for line in data_msg_list])
finally:
file_object.close()
# @staticmethod
# def write_file(data_msg_list,filename='export.sql'):
# """
# 写入文件
# :param datas:
# :param filename:
# :return:
# """
# file_object = None
# try:
# file_object = open('output/'+filename, 'a')
# file_object.writelines([line+'\n' for line in data_msg_list])
# finally:
# file_object.close()