Re: Help me on Backspace please

2008-06-27 Thread cakomo
On Jun 27, 11:09 am, John Machin <[EMAIL PROTECTED]> wrote: > On Jun 27, 5:27 pm, cakomo <[EMAIL PROTECTED]> wrote: > > > On Jun 27, 3:06 am, John Machin <[EMAIL PROTECTED]> wrote: > > >    new_line = re.sub(r'.\x08', old_line, '') > > > >       new_line = re.sub(r'[^\x08]\x08', '', old_line) > > >

Re: Help me on Backspace please

2008-06-27 Thread John Machin
On Jun 27, 5:27 pm, cakomo <[EMAIL PROTECTED]> wrote: > On Jun 27, 3:06 am, John Machin <[EMAIL PROTECTED]> wrote: > >    new_line = re.sub(r'.\x08', old_line, '') > > >       new_line = re.sub(r'[^\x08]\x08', '', old_line) > > Thanks John > I will try it but, do you think regex replacement gonna e

Re: Help me on Backspace please

2008-06-27 Thread cakomo
On Jun 27, 3:06 am, John Machin <[EMAIL PROTECTED]> wrote: > On Jun 27, 6:32 am, [EMAIL PROTECTED] wrote: > > > Hi > > I am a beginner on Python and have a problem.. > > > I have text file and reading it line by line and there are backspace > > characters in it like '\b' or anything you want like "

Re: Help me on Backspace please

2008-06-26 Thread John Machin
On Jun 27, 6:32 am, [EMAIL PROTECTED] wrote: > Hi > I am a beginner on Python and have a problem.. > > I have text file and reading it line by line and there are backspace > characters in it like '\b' or anything you want like "#". I want to > replace these chars. with Backspace action. I mean del

Re: Help me on Backspace please

2008-06-26 Thread Craig Radcliffe
Something like this might do the trick: import re f = open("file.txt") old_text = f.readlines() f.close() new_text = [re.sub(r'.\b', '', i) for i in old_text] f = open("file_modified.txt", "w") f.writelines(new_text) I don't know how necessary the separate read and writes are, but it'll be good

Help me on Backspace please

2008-06-26 Thread cakomo
Hi I am a beginner on Python and have a problem.. I have text file and reading it line by line and there are backspace characters in it like '\b' or anything you want like "#". I want to replace these chars. with Backspace action. I mean deleting the previous char. and the \b char also. and writi