diff options
author | Lan Hui <1348141770@qq.com> | 2021-07-14 15:05:47 +0800 |
---|---|---|
committer | Lan Hui <1348141770@qq.com> | 2021-07-14 15:05:47 +0800 |
commit | 9375d5536c060eaa6c132f7533f8486abfd04074 (patch) | |
tree | 6d88340bb70f9adec6f5a469686609e5777f8160 /example/src/myutil |
Upload Jin Xiongrong's work -- https://gitee.com/dragondove/storode; fix UnicodeDecodeError
Diffstat (limited to 'example/src/myutil')
-rw-r--r-- | example/src/myutil/get_student_number.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/example/src/myutil/get_student_number.py b/example/src/myutil/get_student_number.py new file mode 100644 index 0000000..5f5c22d --- /dev/null +++ b/example/src/myutil/get_student_number.py @@ -0,0 +1,14 @@ +# @req 43b6 +def get_student_number(fname): + f = open(fname, encoding='utf8') + lines = f.readlines() + f.close() + numbers = [] + for line in lines: + line = line.strip() + line = line.replace('\t', ' ') + lst = line.split(' ') + for x in lst: + if len(x) == 12 and x[0] == '2': # @req 43b6:BACK3 + numbers.append(x) + return list(set(numbers)) |