Hi, I'm beginner to python, here I have a very basic question about extracting targeted text. I have thousands of strings like this :
>ref|WP_070076791.1| iron-sulfur protein [Acinetobacter proteolyticus]
Here I only need WP_070076791.1, so I write a script in python:
data = open("data.fasta").read() import re for line in data: start = line.startswith(">ref|") end = line.endswith("| ") number = re.search(r'start(.*?)end',line) print(number)
But it gives me "none", does anybody have idea?