I need to extract information using tweepy on two steps and update global variable location
at the first iteration (check PART1 in my code); then do some data manipulation to return list of locations (or update it), then apply the second part where I extract data from twitter (PART2).
Here is my code:
locations=[[-6.38,49.87,1.77,55.81], [-3.38,39.87,1.77,55.81]]
def Part1():
# Doing something here to get locations, then update the location variable
def Part2():
for l in locations:
# then I need to delete the location (l) from the gloabl list
t1 = Thread(target = Part1)
t2 = Thread(target = Part2)
def main():
t1.start()
t2.start()
Is this the best way to do it ?. What is the recommended way to make location
as a gloabl variable and update/consume it in the both threads.