python - Stop BeautifulSoup from removing whitespace -


beautifulsoup removing whitespace between before newlines tags:

print beautifulsoup("<?xml version='1.0' encoding='utf-8'?><section>    \n</section>") 

the code above prints:

<?xml version="1.0" encoding="utf-8"?> <section> </section> 

notice 4 spaces after section tag missing! interestingly, if do:

print beautifulsoup("<?xml version='1.0' encoding='utf-8'?><section>a    \n</section>") 

i get:

<?xml version="1.0" encoding="utf-8"?> <section>a     </section> 

the 4 spaces after 'a' present! how can 4 spaces show in original print statement?


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -