Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use regular expressions to extract text in Python

Shulou Source: shulou.com Published: 2022-06-02 07:13:19 10月03日 Update

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.

Tags: Text regularities expressions content data articles more knowledge articles good information tools data processing quality reference processing help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Xiaomi Linux Redmi OPPO Reno