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 trialRafay Ahmed
956 PointsI don't understand this?
Now create a second function named delete_by_user that works similarly but deletes files that have a particular username in their filename.
import os
def delete_by_date(date):
for f in os.listdir(os.getcwd() + '/backups'):
if date in f:
os.remove('backups/' + f)
2 Answers
Steven Parker
231,275 PointsActually, the way you've implemented the first function will work for the second task as well. Just replicate the function and give the new copy the other name.
yahav rosner
4,304 PointsYou are right!
Dave Faliskie
17,793 PointsDave Faliskie
17,793 PointsIt want's another function called delete_by_user() that is the same except instead of date it uses the username, so you could just copy/past what you have and rename the function, and change date to username (but don't even have to do that)