Re: Modify HTML data
Peter Hansen wrote: > Swarna wrote: > > Peter Hansen wrote: > >>Swarna wrote: > >>>I am using scp in python to copy a html file on remote server, to my > >>>local machine. Now, i need to update this html file in my local machine > >>>( by adding a new Hyperlink to the existing table od hyperlinks ) and > >>>copy it back (overwriting the old copy ) to the remote server. > >> > >>If you are using scp to copy the file from the remote server in the > >>first place, what's stopping you from using scp to copy it back? > > > > I might be vague in expressing my problem.the problem is not with > > scp. What i need is how to modify the html file in my local machine > > that i got from remote server. > > Ah, so all that stuff about scp was just to distract us from the real > problem? > > Okay, so Lorenzo's advice is fine: grab an HTML parser and use that to > figure out where things are. Or if the problem is defined simply > enough, you could use a regular expression (re module). BeautifulSoup > is often recommended when the HTML is not necessarily very clean... > > Personally, I'd start with an re and move on from there only if that was > for some reason not sufficient. > > -Peter heyi got it worked with simple file object.Thanks, for all your suggestions ! -- http://mail.python.org/mailman/listinfo/python-list
Re: Modify HTML data
Swarna wrote: > Peter Hansen wrote: >>Swarna wrote: >>>I am using scp in python to copy a html file on remote server, to my >>>local machine. Now, i need to update this html file in my local machine >>>( by adding a new Hyperlink to the existing table od hyperlinks ) and >>>copy it back (overwriting the old copy ) to the remote server. >> >>If you are using scp to copy the file from the remote server in the >>first place, what's stopping you from using scp to copy it back? > > I might be vague in expressing my problem.the problem is not with > scp. What i need is how to modify the html file in my local machine > that i got from remote server. Ah, so all that stuff about scp was just to distract us from the real problem? Okay, so Lorenzo's advice is fine: grab an HTML parser and use that to figure out where things are. Or if the problem is defined simply enough, you could use a regular expression (re module). BeautifulSoup is often recommended when the HTML is not necessarily very clean... Personally, I'd start with an re and move on from there only if that was for some reason not sufficient. -Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Modify HTML data
Peter Hansen wrote: > Swarna wrote: > > I am using scp in python to copy a html file on remote server, to my > > local machine. Now, i need to update this html file in my local machine > > ( by adding a new Hyperlink to the existing table od hyperlinks ) and > > copy it back (overwriting the old copy ) to the remote server. > > If you are using scp to copy the file from the remote server in the > first place, what's stopping you from using scp to copy it back? I might be vague in expressing my problem.the problem is not with scp. What i need is how to modify the html file in my local machine that i got from remote server. -- http://mail.python.org/mailman/listinfo/python-list
Re: Modify HTML data
Swarna wrote: > Hi all, > > Can anyone help me with this ? > > I am using scp in python to copy a html file on remote server, to my > local machine. Now, i need to update this html file in my local machine > ( by adding a new Hyperlink to the existing table od hyperlinks ) and > copy it back (overwriting the old copy ) to the remote server. If I understand correctly you need something like PyMeld, ElementTree or BeautifulSoup Lorenzo -- http://mail.python.org/mailman/listinfo/python-list
Re: Modify HTML data
Swarna wrote: > I am using scp in python to copy a html file on remote server, to my > local machine. Now, i need to update this html file in my local machine > ( by adding a new Hyperlink to the existing table od hyperlinks ) and > copy it back (overwriting the old copy ) to the remote server. If you are using scp to copy the file from the remote server in the first place, what's stopping you from using scp to copy it back? -- http://mail.python.org/mailman/listinfo/python-list