Go to a specific line in python?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Thebuilderofdoom
    New Member
    • Mar 2010
    • 18

    Go to a specific line in python?

    i want to go to line 34 in a .txt file and read it how would you do that? In python?
  • Glenton
    Recognized Expert Contributor
    • Nov 2008
    • 391

    #2
    Code:
    myFile=open("whatever.txt")
    for lineNo,line in enumerate(myFile):
        if lineNo==33: break
    #continue with your code here, and line=34th line of text file

    Comment

    Working...