title: python for loop and its generator issue
body: <p>I am trying to generate some link.</p>
  
  <p>NOTE: THERE IS PROBLEM WITH return vs print.</p>
  
  <p>when i write the code with with return, it is only return one linK:</p>
  
  <p>run this code:</p>
  
  <pre><code>import requests
  import re
  
  wikiurl = 'https://en.wikipedia.org/wiki/List_of_states_and_territories_of_the_United_States'
  
  
  state_pat = re.compile(r'title=\"(\w+)\"&gt;')
  
  def get_page_content(url):
      response = requests.get(url)
      return response.text
  
  def link_generator(wikiurl):
      content = get_page_content(wikiurl)
      names = state_pat.findall(content)
      for i in names:
          return 'https://www.local.com/business/results/listing.cfm?s=tile+and+grout+cleaning&amp;ar=' + i + '%2CNY&amp;gsp=ZFZWU1RaU09zWGNYdjFEV1l2ZHFLNVZUUFRPT3c3a21lbFVCbERQOU5VS3p6ai9DRXNMa29PcVZ0ZVV0TXZLM01wUVFUUHZYK2lrMnB5VGJyMHZJeUNoK1dXaUoxZ1NKT3AxbVlJOGN1aVBEb1NRMzlCemdDVHh5aGd3eU5DYUpKWDRtNFVQR0llOFJibUhQR3pSV3ppWFR4ekJoRVltL29UdFQ0MW9KUS9IenJrcjVBMUt3bkErRnlSVnFjRnZ0TjhRWEdET0FuZWRVUGNkemdxUlkzOUYyUjZXbHBzQWRMY3hEUTY4WmtnYkRsSkEvazBrVVY5d0NmSVVMaWp0WnNDNmFsZFNzMitWeHZDYTg2YmJwRGQzSisvOUJaYWNBaFdUd21LaWJpNk9veS9OT1N1VE5DV3RUNDIxdkY5NmZ4bWFVcWtLc1BlVkNRNlEvSG4ydER1T1ZkcXk4Um5BWU5kUU9UZnVOUE9BPQ%253D%253D&amp;lwfilter=&amp;wsrt=&amp;wpn='
  
  
  a = link_generator(wikiurl)
  print(a)
  </code></pre>
  
  <p>and if i run this code adding a print into fuction, it returns all the link, why? i need all the link with <code>return</code></p>
  
  <p>run this code: you will see different:</p>
  
  <pre><code>import requests
  import re
  
  wikiurl = 'https://en.wikipedia.org/wiki/List_of_states_and_territories_of_the_United_States'
  
  
  state_pat = re.compile(r'title=\"(\w+)\"&gt;')
  
  def get_page_content(url):
      response = requests.get(url)
      return response.text
  
  def link_generator(wikiurl):
      content = get_page_content(wikiurl)
      names = state_pat.findall(content)
      for i in names:
          print('https://www.local.com/business/results/listing.cfm?s=tile+and+grout+cleaning&amp;ar=' + i + '%2CNY&amp;gsp=ZFZWU1RaU09zWGNYdjFEV1l2ZHFLNVZUUFRPT3c3a21lbFVCbERQOU5VS3p6ai9DRXNMa29PcVZ0ZVV0TXZLM01wUVFUUHZYK2lrMnB5VGJyMHZJeUNoK1dXaUoxZ1NKT3AxbVlJOGN1aVBEb1NRMzlCemdDVHh5aGd3eU5DYUpKWDRtNFVQR0llOFJibUhQR3pSV3ppWFR4ekJoRVltL29UdFQ0MW9KUS9IenJrcjVBMUt3bkErRnlSVnFjRnZ0TjhRWEdET0FuZWRVUGNkemdxUlkzOUYyUjZXbHBzQWRMY3hEUTY4WmtnYkRsSkEvazBrVVY5d0NmSVVMaWp0WnNDNmFsZFNzMitWeHZDYTg2YmJwRGQzSisvOUJaYWNBaFdUd21LaWJpNk9veS9OT1N1VE5DV3RUNDIxdkY5NmZ4bWFVcWtLc1BlVkNRNlEvSG4ydER1T1ZkcXk4Um5BWU5kUU9UZnVOUE9BPQ%253D%253D&amp;lwfilter=&amp;wsrt=&amp;wpn=')
  
  
  a = link_generator(wikiurl)
  print(a)
  </code></pre>