Skip to content

Instantly share code, notes, and snippets.

@benjaminwand
Created January 9, 2024 14:59
Show Gist options
  • Save benjaminwand/ca157b23384e61fc95a8d337a838f9c2 to your computer and use it in GitHub Desktop.
Save benjaminwand/ca157b23384e61fc95a8d337a838f9c2 to your computer and use it in GitHub Desktop.
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