We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a04a259 commit 8483868Copy full SHA for 8483868
Liez-python-code/0015/0015.py
@@ -0,0 +1,18 @@
1
+import re
2
+import xlwt
3
+
4
+def read2xls(x):
5
+ datatable = xlwt.Workbook(encoding = 'utf-8', style_compression = 0)
6
+ newsheet = datatable.add_sheet('student', cell_overwrite_ok = True)
7
+ num = 0
8
+ with open(x, 'r') as f:
9
+ text = f.read()
10
+ info = re.compile(r'"(\d+)" : "(.*?)"')
11
+ for x in info.findall(text):
12
+ for i in range(len(x)):
13
+ newsheet.write(num, i, x[i])
14
+ num += 1
15
16
+ datatable.save('liez.xls')
17
18
+read2xls('student.txt')
0 commit comments