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
Design an application that opens and analyses word files. Requirements: Create an application that analyses text documents. It should open a text file, read each word into an ap

What are Relative URLS ? When a web browser reads an HTML document, it has a great deal of information about the document. This includes the protocol used to retrieve the docu

You are to write a program that determines the day of the week for New Year's Day in the year 3000. To do this, you must create your own date class (MyDate) and use the following i

How does a program provide "input" to one of its functions?

Write a Program to illustrate the call by value? #include . int compute_sum(int m); int main( void) { int n=3, sum; printf("%d\n",n); /*3 is printed */ sum=compute_sum(n

The system you will develop should provide the following functionality to its users.     1.  Your system should allow the users to aggregate three different RSS feeds (they should

THERE IS ANY1 COULD HELP ME WITH NETLOGO WORK

Write a program that will generate 25 DWORD values in the range from +/-50 representing a two dimensional array of size 5 x 5. It should then display the array as a table (5 x 5) b

Write a program that inputs two positive integers of, at most, 20 digits and outputs the sum of the numbers. If the sum of the numbers has more than 20 digits, output the sum with

I''m doing a project for class in college and im supposed to use today''s date and figure out how old i am in months, days, minutes, and seconds. My question is what is the beset