def output_user_posts(users, file_path = None): print("Outputing users posts...") if not file_path: file_path = USER_POSTS_FOLDER for a_user in users: output_file = file_path + "/UserPosts_" + a_user.uid + ".txt" post.output_posts(a_user.posts, output_file, "w")
def output_user_posts_afile(users, file_path = None, afile_num = 10000): print("Outputing users posts...") if not file_path: file_path = USER_POSTS_FOLDER output_file = "" for i, a_user in enumerate(users): seperate_str = "User ID:" + a_user.uid + "\tUser Name:" + a_user.uname + "\n" if i % afile_num == 0: output_file = file_path + "/UserPosts_#" + str(i) + ".txt" print("Outputing file: ", output_file) post.output_posts(a_user.posts, output_file, "w", seperate_str) else: post.output_posts(a_user.posts, output_file, "a", seperate_str) print("End outputing users #:", len(users))