I need a Python script that can help me organize my Windows computer by sorting files by type from my desktop and putting them into the correct folder. The script should be able to scan my desktop and identify the type of each file based on its extension (e.g., .docx, .jpg, .pdf). Then, it should find the correct folder for each file type (e.g., 'Documents', 'Pictures', 'Videos') and move the corresponding files to the appropriate folder. Can you generate a script that meets these requirements?
Of course, here is a python script that moves your files from desktop to other folders according to the file extension:

```python
import os
from pathlib import Path
from shutil import move

home = Path(os.environ['USERPROFILE'])
src = home / Desktop  # assume English locale

# The mapping from file extensions to destination folders
ext_to_dst = {
    .jpg:  home / Pictures,
    .docx: home / Documents,
    .pdf:  home / Documents,
    .mp4:  home / Videos,
    # add more mappings here as needed
}

for f in src.rglob('*'):
    ext = f.suffix.lower()  # e.g. handle .JPG the same way as .jpg
    dst = ext_to_dst.get(ext)
    if dst:
        shutil.move(f, dst / f.name)
```
Try to include more file types per folder
Sure! Here's a Python script that should accomplish what you're looking for:

```python
import os
import shutil

# define the paths to the desktop and the target folders
desktop_path = os.path.expanduser(~/Desktop)
target_folders = {
    Documents: [doc, docx, txt, pdf],
    Pictures: [jpg, jpeg, png, gif],
    Videos: [mp4, avi, mkv, mov]
}

# loop through all the files on the desktop
for file_name in os.listdir(desktop_path):
    # get the file extension
    extension = file_name.split(.)[-1].lower()

    # find the target folder for this file type
    target_folder = None
    for folder, extensions in target_folders.items():
        if extension in extensions:
            target_folder = folder
            break

    # if we found a target folder, move the file to it
    if target_folder:
        source_path = os.path.join(desktop_path, file_name)
        target_path = os.path.join(os.path.expanduser(~/), target_folder, file_name)
        shutil.move(source_path, target_path)
```

Here's how the script works:

1. The `desktop_path` variable is set to the path to the user's desktop directory.
2. The `target_folders` dictionary maps each target folder name to a list of file extensions that should be moved to that folder.
3. The script loops through all the files in the user's desktop directory using `os.listdir(desktop_path)`.
4. For each file, the script gets the file extension using `split(.)[-1].lower()`.
5. The script then loops through the `target_folders` dictionary and checks if the file extension matches any of the extensions for a given target folder.
6. If a target folder is found, the script constructs the source and target file paths using `os.path.join()` and moves the file to the target folder using `shutil.move()`.

Note that this script assumes that the target folders already exist in the user's home directory. If they don't exist, you'll need to create them manually before running the script. Also, be sure to test the script on a test directory before running it on your actual desktop!