Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTinotenda Tariro Mhishi
9,877 PointsCant Proceed
Im sure im not understanding the question
import os
def delete_by_date(date_string):
for entry in os.scandir('backups'):
if entry.is_file() and date_string in entry.name:
os.remove(entry.path)
return
def delete_by_user(username):
for entry in os.scandir(username):
if entry.is_file() and date_string in entry.name:
os.remove(entry.path)
return
2 Answers
Steven Parker
231,236 PointsI think you have the right idea, but there's no "date_string" parameter in the second function. Did you mean "username" instead?
Jeanette Brown
20,485 Pointsdef delete_by_user(username):
for entry in os.scandir('backups'):
if entry.is_file() and username in entry.name:
os.remove(entry.path)
return
Steven Parker
231,236 PointsFYI: Explicit answers without any explanation are strongly discouraged by Treehouse and may be redacted by moderators.
Tinotenda Tariro Mhishi
9,877 PointsTinotenda Tariro Mhishi
9,877 PointsThanks saw my mistake