Advertisement
amigojapan

python script for adding <BR> at the end of each newline

Mar 5th, 2015
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. #!\bin\python
  2. #copyright Usmar A Padow (amigojapan) 2015 usmpadow@gmail.com
  3. #converts the newlines of a text file to line brakes in HTML
  4. #usage text2html_newlines textfile.txt htmlfile.html
  5. import sys
  6. textfilename = sys.argv[1]
  7. htmlfilename = sys.argv[2]
  8. f = open(textfilename, 'r')
  9. textfile = f.read()
  10. html= textfile.replace('\n', '\n<BR>')
  11. f = open(htmlfilename, 'w')
  12. f.write(html)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement