in this when i am trying to pass the value of new_proj()that is y to the function translate..wher e test_file=new_p roj() its not pass the address to it ...pls tell me the way how to pass it..thanks for the help
Code:
def new_proj():
x= (r"C:\Documents and Settings\KSR\Desktop\%s")%name_entry.get()
if not os.path.exists(x): os.makedirs(x)
shutil.copy2('C:\Documents and Settings\KSR\Desktop\god.cmd',x)
y = x+'\god.cmd'
print x
return y
def replace_words(text, word_dic):
rc = re.compile('|'.join(map(re.escape, word_dic)))
def translate(match):
return word_dic[match.group(0)]
return rc.sub(translate, text)
test_file = new_proj()
fin = open(test_file, "r")
str2 = fin.read()
fin.close()
word_dic = {
'virtex1': 'virtex5',
'ff676': 'jhjak'}
str3 = replace_words(str2, word_dic)
fout = open(test_file, "w")
fout.write(str3)
fout.close()
Comment