471,354 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

to write to a file in python

hey all,
I am new to python & my program need to open up a html file ,change some part of it. I need to modify only certain part of the file which I can identify by some delimiter. Is there any method/way in python that I could use to tell my program to start writing from x to y & rest of the file untouched?
Jul 25 '07 #1
1 1264
possibly with replace(). or

Expand|Select|Wrap|Line Numbers
  1. str=fil.read(bytes before part that needs changed)+part that is changed+fil.read(bytes after change)
Jul 25 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Patrick Useldinger | last post: by
33 posts views Thread by Nick Evans | last post: by
3 posts views Thread by Matthew Warren | last post: by
2 posts views Thread by Thomi Aurel RUAG A | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.