Hi
How to read the second line in text file(MyData,txt)

MyData.txt

line1
line2
line3
line4
line5

read the second line
f = open ("MyData.txt","r")
for line in f:
    if line == 2:
        print line
    else:
        print "somthing wrong !"
f.close()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.