title: How to get text of parent tag without visiting text of its child tag?
body: <p>I know there are other questions but i was not able to get there explanation, I have code below please help.</p>
  
  <p>I want output to make a dictionary like</p>
  
  <pre><code>dictionary
  {
    '[1.1]':'this is extracted text from a parent tag',
    '[1.2]':'this is child tag text',
    '[1.3]':'this is child tag text',
    '[1.4]':'this is child tag text'
  }
  </code></pre>
  
  <p>But the problem is that i am getting the text of parent tag plus child tag in <code>[1.1]</code> not only the parent tag.</p>
  
  <p>I tried others solution but not able to get through it. Please help somebody in some easy way .</p>
  
  <p>My code is here,</p>
  
  <pre><code>from bs4 import BeautifulSoup
  import requests
  
  headers = requests.utils.default_headers()
  headers.update({
      'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36',
  })
  
  URL = "https://patents.google.com/patent/US20120303322A1/en"
  
  content = requests.get(URL, headers=headers)
  soup = BeautifulSoup(content.text,'html.parser')
  
  independent_claim_tag = soup.find('div',{'class':'claim'})
  
  claimdictionary = {}
  
  # While loop to get all the independent claims tag works perfectly!!
  while(independent_claim_tag):
      base = independent_claim_tag.find("div", {"class":"claim"})['num'].lstrip('0')
      print(independent_claim_tag.prettify())
      print('-------')
      elementTags = independent_claim_tag.find_all('div', {'class':'claim-text'})
      i = 1
      for tag in elementTags:
          key = "[ "+str(base)+"."+str(i)+" ] "
          ######################
          # some code need to be here to get only parent tag text for [1.1]
          value = tag.get_text()
          ######################      
          claimdictionary[key.strip()] = value.strip()
          print("[ "+str(base)+"."+str(i)+" ] "+tag.get_text())
          i = i + 1
      print('-------')
      ##################
      ##################
      print("Number of claim Element: "+str(len(independent_claim_tag.find_all('div',{'class':'claim-text'}))))
      print("---- Next Sibling")
      independent_claim_tag = independent_claim_tag.find_next_sibling('div',{'class':'claim'})
  
  
  print(claimdictionary)
  
  </code></pre>
  
  <p>HTML Tag which i need to extract</p>
  
  <pre><code>&lt;div class="claim"&gt;
   &lt;div class="claim" id="CLM-00001" num="00001"&gt;
    &lt;div class="claim-text"&gt;
     &lt;b&gt;
      1
     &lt;/b&gt;
     . A computer readable storage medium comprising a set of instructions which, if executed by a processor, cause a computer to:
     &lt;div class="claim-text"&gt;
      receive data corresponding to a computing node;
     &lt;/div&gt;
     &lt;div class="claim-text"&gt;
      identify a processor usage, a memory usage and an input/output usage based at least in part on the data corresponding to the computing node; and
     &lt;/div&gt;
     &lt;div class="claim-text"&gt;
      determine a compute usage value for the computing node based at least in part on the processor usage, the memory usage and the input/output usage.
     &lt;/div&gt;
    &lt;/div&gt;
   &lt;/div&gt;
  &lt;/div&gt;
  
  Number of claim Element: 4
  </code></pre>
  
  <p>Here Number of claim Element 4 means </p>
  
  <pre><code>{
   '[1.1]' : '1. A computer readable storage medium comprising a set of instructions which, if executed by a processor, cause a computer to:',
  '[1.2]' : 'receive data corresponding to a computing node;',
  '[1.3]' : 'identify a processor usage, a memory usage and an input/output usage based at least in part on the data corresponding to the computing node; and',
  '[1.4]' : 'determine a compute usage value for the computing node based at least in part on the processor usage, the memory usage and the input/output usage.'
  }
  </code></pre>
  
  <p>Updation: This is my output after some Updation</p>
  
  <pre><code>&lt;div class="claim"&gt;
   &lt;div class="claim" id="CLM-00001" num="00001"&gt;
    &lt;div class="claim-text"&gt;
     &lt;b&gt;
      1
     &lt;/b&gt;
     . A computer readable storage medium comprising a set of instructions which, if executed by a processor, cause a computer to:
     &lt;div class="claim-text"&gt;
      receive data corresponding to a computing node;
     &lt;/div&gt;
     &lt;div class="claim-text"&gt;
      identify a processor usage, a memory usage and an input/output usage based at least in part on the data corresponding to the computing node; and
     &lt;/div&gt;
     &lt;div class="claim-text"&gt;
      determine a compute usage value for the computing node based at least in part on the processor usage, the memory usage and the input/output usage.
     &lt;/div&gt;
    &lt;/div&gt;
   &lt;/div&gt;
  &lt;/div&gt;
  
  -------
  [ 1.1 ]  1. A computer readable storage medium comprising a set of instructions which, if executed by a processor, cause a computer to:
  receive data corresponding to a computing node; identify a processor usage, a memory usage and an input/output usage based at least in part on the data corresponding to the computing node; and determine a compute usage value for the computing node based at least in part on the processor usage, the memory usage and the input/output usage.
  [ 1.2 ] receive data corresponding to a computing node;
  [ 1.3 ] identify a processor usage, a memory usage and an input/output usage based at least in part on the data corresponding to the computing node; and
  [ 1.4 ] determine a compute usage value for the computing node based at least in part on the processor usage, the memory usage and the input/output usage.
  -------
  Number of claim Element: 4
  ---- Next Sibling
  &lt;div class="claim"&gt;
   &lt;div class="claim" id="CLM-00008" num="00008"&gt;
    &lt;div class="claim-text"&gt;
     &lt;b&gt;
      8
     &lt;/b&gt;
     . A system comprising:
     &lt;div class="claim-text"&gt;
      a processor; and
     &lt;/div&gt;
     &lt;div class="claim-text"&gt;
      a computer readable storage medium including a set of instructions which, if executed by the processor, cause the system to,
      &lt;div class="claim-text"&gt;
       receive data corresponding to a computing node,
      &lt;/div&gt;
      &lt;div class="claim-text"&gt;
       identify a processor usage, a memory usage and an input/output usage based at least in part on the data corresponding to the computing node, and
      &lt;/div&gt;
      &lt;div class="claim-text"&gt;
       determine a compute usage value for the computing node based at least in part on the processor usage, the memory usage and the input/output usage.
      &lt;/div&gt;
     &lt;/div&gt;
    &lt;/div&gt;
   &lt;/div&gt;
  &lt;/div&gt;
  
  -------
  [ 8.1 ]  8. A system comprising:
  a processor; and a computer readable storage medium including a set of instructions which, if executed by the processor, cause the system to,
  receive data corresponding to a computing node,
  identify a processor usage, a memory usage and an input/output usage based at least in part on the data corresponding to the computing node, and
  determine a compute usage value for the computing node based at least in part on the processor usage, the memory usage and the input/output usage.
  
  [ 8.2 ] a processor; and
  [ 8.3 ] a computer readable storage medium including a set of instructions which, if executed by the processor, cause the system to,
  receive data corresponding to a computing node,
  identify a processor usage, a memory usage and an input/output usage based at least in part on the data corresponding to the computing node, and
  determine a compute usage value for the computing node based at least in part on the processor usage, the memory usage and the input/output usage.
  
  [ 8.4 ] receive data corresponding to a computing node,
  [ 8.5 ] identify a processor usage, a memory usage and an input/output usage based at least in part on the data corresponding to the computing node, and
  [ 8.6 ] determine a compute usage value for the computing node based at least in part on the processor usage, the memory usage and the input/output usage.
  -------
  Number of claim Element: 6
  ---- Next Sibling
  &lt;div class="claim"&gt;
   &lt;div class="claim" id="CLM-00015" num="00015"&gt;
    &lt;div class="claim-text"&gt;
     &lt;b&gt;
      15
     &lt;/b&gt;
     . A computer readable storage medium comprising a set of instructions which, if executed by a processor, cause a computer to:
     &lt;div class="claim-text"&gt;
      collect data corresponding to a computing node, wherein the data is to be associated with a processor usage, a memory usage and an input/output usage; and
     &lt;/div&gt;
     &lt;div class="claim-text"&gt;
      send the data to a compute usage calculation node.
     &lt;/div&gt;
    &lt;/div&gt;
   &lt;/div&gt;
  &lt;/div&gt;
  
  -------
  [ 15.1 ]  15. A computer readable storage medium comprising a set of instructions which, if executed by a processor, cause a computer to:
  collect data corresponding to a computing node, wherein the data is to be associated with a processor usage, a memory usage and an input/output usage; and send the data to a compute usage calculation node.
  [ 15.2 ] collect data corresponding to a computing node, wherein the data is to be associated with a processor usage, a memory usage and an input/output usage; and
  [ 15.3 ] send the data to a compute usage calculation node.
  -------
  Number of claim Element: 3
  ---- Next Sibling
  </code></pre>