I have two problems now with a text file :
a) First: I have a text file (it's a log), this log has many lines: 2221. I just want to print from line 2211 to 2220. How can I do this?
I have this code:
line_number=2011
with open('file.log') as f:
i = 2011
for line in f:
if i == line_number:
break
i += 1
print (line)
but print all the file
b) Second: Well, the lines 2211 to 2220 are this:
Dominio1.BL00010001.pdb 24.69530
Dominio1.BL00020001.pdb 14.33748
Dominio1.BL00030001.pdb 30.53454
Dominio1.BL00040001.pdb 23.82516
Dominio1.BL00050001.pdb 27.48684
Dominio1.BL00060001.pdb 18.17364
Dominio1.BL00070001.pdb 30.98407
Dominio1.BL00080001.pdb 17.19927
Dominio1.BL00090001.pdb 19.02460
Dominio1.BL00100001.pdb 22.57086
I want to create a code that selects the number line that has the smallest number (identify),and read the name of the .pdb (just the 24 characters of the line that has the smallest number).Cause, I need identify what's the .pdb that has the smallest number, and use it like a string in other script, like this:
model='%s'%R
where '%s'%R is the name of .pdb that i need
How can I do it?