Parsing two different html sources and combining the output
Question: I am parsing two different html sources (one spits out "data A,B,C,D, and E"
and the other spits out "data F") with two different scripts. I want to
combine the output of both of these scripts into a simple csv format.

I am trying to run a 3rd script that imports everything from the other two
scripts and prints out the data. This is what I am doing to try and make this
happen:

    
    
    #!usr/bin/env python
    
    from script1 import *
    from script2 import *
    
    for c in cities :
       c.retrieveTemps()
       print(c.name,c.high0,c.low0,c.high1,c.low1,c.weather0,c.weather1,c.wind0,c.wind1)
    

All the variables are defined in script1 and script2. Script1 finds every
variable except for c.wind1. However, when I run the above code, it will only
find the data for either script1 OR script2 (depending on which one I import
second), not both.

Any ideas on what I can do to get it to print out all the data from both
script1 and script2? Thanks!

**EDIT**

This is from script1:

    
    
    #!usr/bin/env python
    
    import re
    import urllib
    from datetime import datetime
    from datetime import timedelta
    
    date = datetime.now()
    date1 = date + timedelta(days=1)
    date2 = date + timedelta(days=2)
    
    
    class city :
            def __init__(self, city_name, link) :
                    self.name = city_name
                    self.url = link
                    self.wind1 = 0
    
        def retrieveTemps(self) :
                filehandle = urllib.urlopen(self.url)
    
                # get lines from result into array
                lines = filehandle.readlines()
    
                # (for each) loop through each line in lines
                line_number = 0 # a counter for line number
                for line in lines:
                        line_number = line_number + 1 # increment counter
    
                        # find string, position otherwise position is -1
    
                        position2 = line.rfind('<ul class="stats">')
    
                        #String is found in line
    
                        if position2 > 0 :
                                self.wind0 = lines[line_number + 1].split('</strong>')[0].split('style="">')[-1]
    
                                break # done with loop, break out of it
    
                return ('c.wind0')
    
                filehandle.close()
    
    m1 = city('Mexico City', 'http://www.accuweather.com/en/mx/mexico-city/242560/daily-weather-forecast/242560?day=2')
    m3 = city('Veracruz', 'http://www.accuweather.com/en/mx/veracruz/236233/daily-weather-forecast/236233?day=2')
    m5 = city('Tampico', 'http://www.accuweather.com/en/mx/tampico/235985/daily-weather-forecast/235985?day=2')
    m7 = city('Nuevo Laredo', 'http://www.accuweather.com/en/mx/nuevo-laredo/235983/daily-weather-forecast/235983?day=2')
    m9 = city('Monterrey', 'http://www.accuweather.com/en/mx/monterrey/244681/daily-weather-forecast/244681?day=2')
    m11 = city('S. Luis Potosi', 'http://www.accuweather.com/en/mx/san-luis-potosi/245369/daily-weather-forecast/245369?day=2')
    m13 = city('Queretaro', 'http://www.accuweather.com/en/mx/queretaro/245027/daily-weather-forecast/245027?day=2')
    m15 = city('Laz. Cardenas', 'http://www.accuweather.com/en/mx/lazaro-cardenas/239054/daily-weather-forecast/239054?day=2')
    
    cities = []
    cities.append(m1)
    cities.append(m3)
    cities.append(m5)
    cities.append(m7)
    cities.append(m9)
    cities.append(m11)
    cities.append(m13))
    cities.append(m15)
    


Answer: Don't do this. Importing the namespace of a module is the wrong way. The two
Python scripts don't 'spit out' data. Write methods, import them, call them,
use the result.

`script1.py`

    
    
    def foo():
        return (1, 2, 3)
    

`script2.py`

    
    
    def bar():
        return ('a', 'b', 'c')
    

`script3.py`

    
    
    from script1 import foo
    from script2 import bar
    
    combinedResult = foo() + bar()
    

