I Want to copy an specific line from a txt file (let's say the first line), so i could use that line in my program later. also i want to be able to copy other lines too.
            Asked
            
        
        
            Active
            
        
            Viewed 182 times
        
    1 Answers
-1
            
            
        readline() function should help you. It returns a list of lines which you could then use whenever you want in code.
 
    
    
        Charlton Figueira
        
- 16
- 2
- 
                    hey. but how does this works? like if i want to copy the second line of my txt file i should write file.readline(2) ? – Armin Mar 14 '20 at 09:36
- 
                    1Try this(replace the path with your file path), `with open ("C:\Users\PycharmProjects\untitled\sorted_cron.txt", 'r') as f:` `line=f.readlines()` `print (line[0])` – Gokul nath Mar 16 '20 at 09:02
