def get_all_accounts(csv_path, keyIndex): """ #@Arguments: #csv_path = Path string for the .csv file which contains all accounts information. #keyIndex = The integer representing the index position for screen_name in the csv file #op = mode for writing the output file, 'w' by default. If none found, a new one is created #Return: None, only writes information on file """ pu.set_unicode() #accounts = file_loader.loadCSV(csv_path, keyIndex) header = "group;subgroup;name;screen_name;lang;twitter_id;" header += "followers_count;listed_count;statuses_count;friends_count;favourites_count;" header += "url;created_at;time_zone\n" #Creating files which will contain information about all accounts and their file path which will contain the followers f_index = file_loader.loadPath(_output_path+'index.txt') f_csv = file_loader.loadPath(_output_path+'all-users.csv') f_csv.write(header) total = len(accounts) i = 0 #Iterating over the dictionary with all accounts for screen_name in accounts.keys(): p = Person() #If the user is labeled in more than one group/subgroup, it will be considered the last one user = accounts[screen_name].pop() p_path = _output_path+user['group']+'/'+user['subgroup']+'/'+screen_name+".txt" info = get_user_info(screen_name) #if twitter account exists, PS: user data is at info[0]: if info is not False: f_index.write(p_path+'\n') save_user_info(p, info[0], user['group'], user['subgroup'], header, p_path) f_csv.write(str(p)) i = i + 1 #Printing the progress on the screen print 'Status: ', str(round(100*float(i)/total,2))+'% completed' f_index.close() f_csv.close()