Created
January 9, 2024 14:59
-
-
Save benjaminwand/ca157b23384e61fc95a8d337a838f9c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
# Assuming your CSV file is named 'wikiusers.csv' | |
file_path = 'wikiusers.csv' | |
# Read the CSV file into a DataFrame | |
df = pd.read_csv(file_path) | |
# Extract the first column, which are the user names, into a Python array | |
names_list = df.iloc[:, 0].values | |
# Open a text file for writing | |
with open("output.txt", "w") as file: | |
# Iterate through the words and write each line to the file | |
for name in names_list: | |
line = f"{{{{page>user:{name}&noedit&nofooter}}}}\n" | |
file.write(line) | |
# Confirm that the file has been created with the desired content | |
with open("output.txt", "r") as file: | |
print(file.read()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment