Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python get line number x in file

f=open('filename')
lines=f.readlines()
print lines[25]
print lines[29]
Comment

PREVIOUS NEXT
Code Example
Python :: xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 0 
Python :: async python 
Python :: duplicate in list 
Python :: get all files in pc python 
Python :: add item to python dictionary 
Python :: plotly go axis labels 
Python :: find frequency of numbers in list python 
Python :: new line in python 
Python :: views.py django 
Python :: python elapsed time module 
Python :: gradient boosting regressor 
Python :: get ip address python 
Python :: initialize a 2d list python 
Python :: python do something while waiting for input 
Python :: python using enum module 
Python :: only read some columns from csv 
Python :: heatmap in python 
Python :: binary gap python 
Python :: import stock data from yahoo finance 
Python :: python for loop with step 
Python :: tkinter text editor 
Python :: install python3.6 in linux 
Python :: python remove common elements between two lists 
Python :: python 3.7 install snakemake 
Python :: find next multiple of 5 python 
Python :: how to check if value is in list python 
Python :: df add value at first index 
Python :: Invalid comparison between dtype=datetime64[ns] and date filter 
Python :: how to take two space separated int in python 
Python :: I have string index in pandas DataFrame how can I select by startswith? 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =