Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

#!/usr/bin/env python3 

import fileinput 

import matplotlib 

filename = matplotlib.matplotlib_fname() 

print('In file: {}'.format(filename)) 

text_to_search = 'backend ' 

replacement_text = '#backend ' 

print('replace {} by {}'.format(text_to_search, replacement_text)) 

with fileinput.FileInput(filename, inplace=True, backup='.bak') as file: 

for line in file: 

print(line.replace(text_to_search, replacement_text), end='')