How to use regular expressions to extract text in Python
This article will explain in detail how to use regular expressions to extract text in Python. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.
Use the OCR tool to extract the information as follows:
Extract text Keratin type ll cytoskeletal 1 OS=Homo sapiens OX=9606 GN=KRT1 PE=1 SV=6Keratin type I cytoskeletal 10 OS=Homo sapiens OX=9606 GN=KRT10 | PE=1 SV=6Pyruvate carboxylase mitochondrial OS=Homo sapiens OX=9606 GN=PC PE=1 SV=2
Solve the problem:
# load data df
# data processing df ["extract text"] .str.extract ("GN= (\ w+)")
On how to use regular expressions to extract text in Python to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.