Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
need help with xpath
#2
That would be the text under p tag,so should be like this.
tv.xpath("//p[@class='drug-subtitle']/text()")
That should give.
Output:
ziprasidone (zi PRAY si done)
So a quick clean up to get word.
>>> s = ' ziprasidone (zi PRAY si done)'
>>> s.strip().split(' (')[0]
'ziprasidone'
Reply


Messages In This Thread
need help with xpath - by pythonprogrammer - Jan-18-2020, 08:23 PM
RE: need help with xpath - by snippsat - Jan-18-2020, 11:28 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020