Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python read file delete first line

with open('file.txt', 'r') as fin:
    data = fin.read().splitlines(True)
with open('file.txt', 'w') as fout:
    fout.writelines(data[1:])
Comment

PREVIOUS NEXT
Code Example
Python :: convert seconds to hours python 
Python :: supprimer fichier pythpn 
Python :: stripping /n in a readlines for a pytgon file 
Python :: rectangle in tkinter 
Python :: user agents list 
Python :: pandas to csv without header 
Python :: werkzeug.datastructures.filestorage to numpy 
Python :: make first row columns pandas 
Python :: python roman to integer 
Python :: eigenvectors python 
Python :: python how to get number of strings in a list 
Python :: fibonacci series python recursion 
Python :: python loop through directory 
Python :: python sqrt import 
Python :: df.drop index 
Python :: mean squared error python 
Python :: insertion sort python 
Python :: mongodb between two values 
Python :: python word cloud 
Python :: python print only 2 decimals 
Python :: python print dict pretty 
Python :: plot model 
Python :: matplotlib change font 
Python :: openpyxl read excel 
Python :: how to remove coma in python 
Python :: print pandas version 
Python :: add x axis label python 
Python :: os.execl(sys.executable, sys.executable, *sys.argv) 
Python :: python csv write add new line 
Python :: get next multiple of a number 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =