Python, Programming Languages

Assignment Help:
Write a python script that will take two file names as input (src, dest). Open src reading each line in the file, and replacing any occurrences of name with the string "redacted". The resulting rewritten lines will be written to dest. Hint: The re.sub function will be your friend.

This is my attempted solution:

import re

def q12(src, dst):
file_open = (''scr'',''r'')

re.sub(''name'', ''redacted'', string, count=0, flags=0)

file.readline()

outfile = open(''dst'', ''w'')

outfile.write(''dst'')

Related Discussions:- Python

Define the if - else statement - computer programming, Define the If - else...

Define the If - else statement - computer programming? The If - else statement The universal form of if - else statement is                         if(expression)

How to create an html document?, An HTML document may be created via any HT...

An HTML document may be created via any HTML editor or text editor such as notepad etc.

Matlab error, n2=2:100; t=3; while t { g3(t)=(1/2)*(0.63)*(0.8....

n2=2:100; t=3; while t { g3(t)=(1/2)*(0.63)*(0.8.^(n2)); t=t+1; } g3(1)=0; g3(2)=0; what is wrong with the code above? it tells me that line: g3(t)=(1/2)

Lmc, Plan, design and dry run a program for the Little Man Computer (LMC) t...

Plan, design and dry run a program for the Little Man Computer (LMC) that produces the same result using a fixed number of 10 iterations.

Advantages of visual basic programming language, Advantages of visual basic...

Advantages of visual basic programming language Visual Basic is an exclusive selection language published by Microsoft Company, so programs published in Visible Basic cannot, e

Web services information language, Web Services Information Language WCF is...

Web Services Information Language WCF is designed using assistance focused structure concepts to support allocated processing where solutions have distant customers. Customers can

Expressions and truth tables, Create a logical expression that corresponds ...

Create a logical expression that corresponds to the following statement: If you like talking about computers or playing video games at LAN parties, and you want to meet others w

Shopping Cart, Shopping Cart Purpose – Allows user to browse while keeping ...

Shopping Cart Purpose – Allows user to browse while keeping track of the items in which they will purchase at the end on the order page link and this will give a final price for al

Get variable data, How do i get back data from a FOR loop in order to prin...

How do i get back data from a FOR loop in order to print them on screen?

We need help for build a price quote generator, We need help for build a Pr...

We need help for build a Price Quote Generator I am interested in two things (A) a web based system that will allow a user to enter the parameters of their contests (there are o

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd