extracting element and insert a space

前端 未结 3 931
挽巷
挽巷 2021-02-04 03:29

im parsing html using BeautifulSoup in python

i dont know how to insert a space when extracting text element

this is the code:

import BeautifulSo         


        
3条回答
  •  执笔经年
    2021-02-04 03:59

    Use getText instead:

    import BeautifulSoup
    soup=BeautifulSoup.BeautifulSoup('thisisexample')
    
    print soup.getText(separator=u' ')
    # u'this is example'
    

提交回复
热议问题