擅长:python、mysql、java
<pre><code>import re
a_file = open("your_path/test.txt", "r")
list1 = []
list2 = []
for line in a_file:
if not line.strip(): continue # skip the empty line
stripped_line = line.strip()
line_list = ''.join(stripped_line)
# To consider '_' in the first list
#x = re.findall(r"\b_\w+", line_list)
if (line_list.isupper()): # if (x):
list1.append(line_list)`
else:
list2.append(line_list)
</code></pre>