I have a number of text files with a layout like below,
heading
subheading
info1
info2
info3
where the character count of each line will vary from file to file. For each file, I'd like to store line 2 as a Python variable.
I can load the whole file into a variable,
with open('data.txt', 'r') as myfile:
data=myfile.read().replace('\n', '')
but I am unsure how to specify to read only line 2.