Modify HTML data

S

Swarna

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.

Thanks, for your time !
Swarna.
 
P

Peter Hansen

Swarna said:
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?
 
L

lbolognini

Swarna said:
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
 
S

Swarna

Peter said:
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.
 
P

Peter Hansen

Swarna said:
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? <wink>

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
 
S

Swarna

Peter said:
Ah, so all that stuff about scp was just to distract us from the real
problem? <wink>

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

hey........i got it worked with simple file object.....Thanks, for
all your suggestions !
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Forum statistics

Threads
474,270
Messages
2,571,341
Members
48,029
Latest member
Anchorman2022

Latest Threads

Top