Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Challenge: Batch File Organizer | Automation Fundamentals for DevOps
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Python for DevOps Beginners

bookChallenge: Batch File Organizer

Organizing files by their type is a frequent and essential task in DevOps automation, especially when you need to manage large numbers of log files, configuration files, or documentation. By categorizing files based on their extensions, you can streamline maintenance, automate clean-up processes, and quickly locate the files you need. In this challenge, you will practice this foundational automation skill by writing a Python script that groups a hardcoded list of filenames into categories according to their file extensions.

Compito

Swipe to start coding

Write a function that takes a list of filenames and returns a dictionary organizing the filenames by their file extensions.

  • For each filename in the list, determine its file extension (the substring after the last period, including the period).
  • If a filename has no extension, categorize it under an empty string as the key.
  • Group all filenames with the same extension together in a list under their extension's key in the dictionary.
  • Return the resulting dictionary.

Soluzione

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 3
single

single

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

Suggested prompts:

Can you give me an example of the list of filenames to use?

What are the specific categories or file types I should consider?

Could you explain how the grouping should be presented in the output?

close

bookChallenge: Batch File Organizer

Scorri per mostrare il menu

Organizing files by their type is a frequent and essential task in DevOps automation, especially when you need to manage large numbers of log files, configuration files, or documentation. By categorizing files based on their extensions, you can streamline maintenance, automate clean-up processes, and quickly locate the files you need. In this challenge, you will practice this foundational automation skill by writing a Python script that groups a hardcoded list of filenames into categories according to their file extensions.

Compito

Swipe to start coding

Write a function that takes a list of filenames and returns a dictionary organizing the filenames by their file extensions.

  • For each filename in the list, determine its file extension (the substring after the last period, including the period).
  • If a filename has no extension, categorize it under an empty string as the key.
  • Group all filenames with the same extension together in a list under their extension's key in the dictionary.
  • Return the resulting dictionary.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 3
single

single

some-alt