To store the data in a table format, you can use the pandas library in Python. Here is an example of how you can convert the given dictionary into a table:

import pandas as pd

image_mapping = {
    'image_1': {'psd': 'image_1.psd', 'jpg': 'image_1.jpg', 'png': 'image_1.png'},
    'image_2': {'psd': 'image_2.psd', 'jpg': 'image_2.jpg', 'png': 'image_2.png'},
    'image_3': {'psd': 'image_3.psd', 'jpg': 'image_3.jpg', 'png': 'image_3.png'},
    'image_4': {'psd': 'image_4.psd', 'jpg': 'image_4.jpg', 'png': 'image_4.png'}
}

df = pd.DataFrame.from_dict(image_mapping, orient='index')
df = df[['psd', 'jpg', 'png']]
print(df)

This will output:

           psd         jpg         png
image_1  image_1.psd  image_1.jpg  image_1.png
image_2  image_2.psd  image_2.jpg  image_2.png
image_3  image_3.psd  image_3.jpg  image_3.png
image_4  image_4.psd  image_4.jpg  image_4.png

Now, you have the data stored in a table format with columns 'psd', 'jpg', and 'png'

image_mapping = image_1 psd image_1psd jpg image_1jpg png image_1png image_2 psd image_2psd jpg image_2jpg png image_2png image_3 psd image_3psd jpg ima

原文地址: https://www.cveoy.top/t/topic/ijMd 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录