i've been trying to fix this but i can't find any useful solution. I'm trying to create a new text file with a given list that writes each element of the list on each line of the text file, but it keeps creating the text file on my "C:\Users\myuser" folder, when it should be creating it in the current folder where the program is stored at. Can anyone please help me fix this, Thanks so much.
Code:
def mention_text(usernames,users_per_line):
print("Creating mentions text...")
n = m = 0
ments = []
while m < len(usernames):
m = m+users_per_line
ments.append(str(" ".join(usernames[n:m])))
n = m
with open("mentions.txt", "w") as mentions:
for i in ments:
mentions.write(i + "\n")
print("Done")