如何拆分文本数组?

Cha*_*gaD -1 python django

我有一系列的答案,包括标记.

语法 - ["ANSWER1 | MARK1,ANSWER2 | MARK2 ...]

answers = ["Human machine interface for lab abc computer applications|3",
             "A survey of user opinion of computer system response time|4",
             "The EPS user interface management system|2",
             "System and human system engineering testing of EPS|1"]
Run Code Online (Sandbox Code Playgroud)

我需要拆分这些并为每个答案提取标记.我该怎么做 ?

Tim*_*ker 5

例如:

>>> [a.split("|") for a in answers]
[['Human machine interface for lab abc computer applications', '3'], 
['A survey of user opinion of computer system response time', '4'], 
['The EPS user interface management system', '2'], 
['System and human system engineering testing of EPS', '1']]
Run Code Online (Sandbox Code Playgroud)