put output folder in a variable

This commit is contained in:
quenousimporte 2024-09-25 09:21:55 +02:00
parent fd3cb6c75b
commit 75e84d50f8
1 changed files with 4 additions and 3 deletions

View File

@ -8,10 +8,11 @@ import re
username = ""
password = ""
imapserver = ""
folder = "notes"
N = 500
if not os.path.isdir('notes'):
os.mkdir('notes')
if not os.path.isdir(folder):
os.mkdir(folder)
imap = imaplib.IMAP4_SSL(imapserver)
imap.login(username, password)
@ -35,7 +36,7 @@ for i in range(messages, max(0, messages-N), -1):
print(str(i) + ' - ' + subject)
filepath = subject + '.md'
filepath = os.path.join('notes', filepath)
filepath = os.path.join(folder, filepath)
if msg.is_multipart():
for part in msg.walk():