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)


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

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
This is what I have so far def root_brent(f, a, b, errorlimit = tinyerror, n = -1, r_i = 0): # f(a) and f(b) must have opposite signs poly = remove_multiple_roots(poly) counter

2. TEST & AND TEST is like CMP, it is used for conditional statement, and doesn’t save the answer. AND is logical multiplication. 3. INS & IN IN is used for data transfer from I/O

Implement a two-dimensional table in Prolog. Your program will contain: An insert_entry predicate that takes a table, row, column and an entry and inserts the entry at the g

Pre-order integration on Shopify store We are looking for on-call developers who can integrate Celery on client Shopify stores. Requirements a) Contented editing Shopify them

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

A manager at the local Walmart needs to determine how many workers to hire to cover a 24-hour period. Each worker must work 9 consecutive hours but may only start work at the begin

code for using tree view control and fill it with database using and language

Explain, in your own words, how web designers can deal with CSS conflict resolution. What is the order of precedence between the different types of CSS (inline, embedded and extern

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

Let us first see the skeleton of a JavaScript file. JavaScript code should be written between the and tags. The value LANGUAGE = "JavaScript" indicates to the browser that J