Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Organize Content Assets by Type | Automating Content Workflows
Practice
Projects
Quizzes & Challenges
Quizer
Challenges
/
Python for Content Creators
Seksjon 1. Kapittel 3
single

single

bookChallenge: Organize Content Assets by Type

Sveip for å vise menyen

Keeping your content assets organized is crucial for managing a growing library of images, videos, and documents. As a content creator, you often deal with dozens or even hundreds of files, and manually sorting them can be tedious and error-prone. Automating this organizational process with Python not only saves you time but also ensures your files are always in the right place, making them easier to find and use in future projects. By simulating the creation of subfolders and moving files into them based on their type, you can develop a workflow that mirrors best practices for digital asset management—without the risk of accidentally moving files during testing.

Oppgave

Swipe to start coding

Write a function that simulates organizing a list of mixed content files into subfolders by file type.

  • Use the provided file_list parameter, which contains file names with extensions.
  • Identify the type of each file based on its extension: images (.jpg, .jpeg, .png, .gif, .bmp), videos (.mp4, .mov, .avi, .mkv), and documents (.pdf, .docx, .txt, .xlsx).
  • For each file, print a line simulating the creation of the corresponding folder if it has not already been created.
  • Print a line simulating moving the file to the appropriate folder.
  • If a file does not match any of the known types, simulate creating and moving it to an "others" folder.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 3
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

some-alt