INNER CODE UNIT · Python

remove_comment_start_end

tanersener/mobile-ffmpeg · src/libsndfile/make_lite.py:151

def remove_comment_start_end (filename, start_comment, end_comment):
	source_code = open (filename, 'r').read ()

	while 1:
		start_index = string.find (source_code, start_comment)
		end_index = string.find (source_code, end_comment)
		if start_index < 0 or end_index < start_index:
			break
		end_index += len (end_comment)
		source_code = source_code [:start_index-1] + source_code [end_index:] ;

	open (filename, 'w').write (source_code)

def remove_strings_from_file (filename, str_list):
	file_text = open (filename, 'r').read ()
	for current_str in str_list:
		file_text = string.replace (file_text, current_str, '')
	open (filename, 'w').write (file_text)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…