Python, Programming Languages

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'')
Posted Date: 4/2/2012 9:08:07 PM | Location : United States







Related Discussions:- Python, Assignment Help, Ask Question on Python, Get Answer, Expert's Help, Python Discussions

Write discussion on Python
Your posts are moderated
Related Questions
I need to do image reconstruction using Neural Network using Matlab

Write a program that takes integer array of 8 elements from user and find the smallest element among them using pointers

Write a program that will allow the user to input the corners of a triangle. The program will draw small yellow circles for each input point, then draw the triangle and calculate t

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

What are the string data transfer instruction in assembly language? Explain all types of string data transfer instructions with examples of each? What will be the behavior of direc

Characteristics of procedure-oriented programming: Emphasis is on doing things (algorithms). Large programs are divided into smaller programs known as functions.

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

3d Interpolation using matlab from x,y, and z coordinates in a csv file and reading them after that interpolating them..

We next require taking a look at arithmetic involving matrices. We'll begin with addition and subtraction of two matrices. Therefore, assume that we have two n x m matrices, which

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4