EGN <pilati...@gmail.com> added the comment:
But if I'm taking main for loop out of the square brackets everything works fine. from os import getcwd, listdir, rename import re for n in listdir(p := f"{getcwd()}\\{input('Folder: ')}\\"): [rename(f'{p}{n}', f"{p}{''.join([w[:3] if len(w) > 3 else w for w in re.split('[-_. ]', n)[:-1]])}.{n.split('.')[-1]}")] ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38556> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com