Python Forum
Batch processing and saving into new folder
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Batch processing and saving into new folder
#3
(Jun-09-2018, 08:56 PM)ljmetzger Wrote:
    for key in dic.keys():
        for key2 in dic[key]:
            dic2[key + ' ' + str(key2)] = dic[key][key2]

I gave the code a cursory look, and this part has drawn my attention. Iterating over dict.keys() maybe was acceptable in 2.2 or 2.3 - but for years it has been considered un-Pythonic, since iteration over dictionary already yields keys

Moreover, you can iterate over items
for key, dic2 in dic.items:
    for key2, value2 in dic2.items()
        dic2[key + ' ' + str(key2)] = value
Actually, a lot of things in your code look off - converting to dict, and then working hard to rearrange - but I am not up to the task now
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply


Messages In This Thread
RE: Batch processing and saving into new folder - by volcano63 - Jun-09-2018, 09:51 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Sad Miss-Classification problem with shuffled batch Faebs94 0 1,563 Sep-02-2021, 11:55 AM
Last Post: Faebs94
  Help batch converting .json chosen file to MySQL BrandonKastning 2 2,354 Mar-14-2020, 09:19 PM
Last Post: BrandonKastning
  Matplolib graphic from batch achilledue 2 2,543 Sep-11-2019, 08:43 AM
Last Post: buran
  Assign image names in folder to images in other folder. ujjwalrathod007 15 7,826 Sep-03-2018, 05:27 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020