N
N
Nikolai Sidorenko2014-12-10 23:43:32
Python
Nikolai Sidorenko, 2014-12-10 23:43:32

How to delete a line in a file using python?

The entire Internet was covered - everywhere only with replacements for spaces and the like. Nowhere can I find a function that could delete a line in a file without leaving a hyphen.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Shilov, 2014-12-11
@NSidorov

https://clck.ru/9NjHe

A
Arseny Kravchenko, 2014-12-13
@Arseny_Info

f = open('file.txt').read()
f = f.replace('YOUR_STRING\n','')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question