Python Forum
Displaying duplicates in dictionary
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Displaying duplicates in dictionary
#1
Hi,

I am trying to below snippet of code but displaying duplicates. Can you please let me know where i did mistake.

src_base_path="/data/infy"
year_mth="2020-10-05"
folder_names = "1, 2, 3"
table_names = "bt1, bt2, bt3"

src_path = '{0}/{1}/app_date={2}/source={3}/'
input_dict = {}
input_body = []
tables = list(table_names.split(', '))
print("Tables to be processed: {}".format(tables))
folders = list(folder_names.split(', '))
print("Folders to be processed: {}".format(folders))
for i in range(len(folders)):
    for j in range(0,len(tables)):
        input_body.append({'sourcePath': src_path.format(src_base_path, tables[j], year_mth, folders[i]), 'tableName': tables[j]})
input_dict['tables'] = input_body
print("Input_body: {}".format(input_dict))
print(input_dict)
Thanks in advance
Reply


Messages In This Thread
Displaying duplicates in dictionary - by lokesh - Oct-15-2020, 07:45 AM
RE: Displaying duplicates in dictionary - by buran - Oct-15-2020, 08:06 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  remove partial duplicates from csv ledgreve 0 820 Dec-12-2022, 04:21 PM
Last Post: ledgreve
  Problem : Count the number of Duplicates NeedHelpPython 3 4,425 Dec-16-2021, 06:53 AM
Last Post: Gribouillis
  Removal of duplicates teebee891 1 1,820 Feb-01-2021, 12:06 PM
Last Post: jefsummers
  Dictionary iteration and creation a new dictionary from duplicates xrsxlnx 2 2,165 Mar-30-2020, 10:43 AM
Last Post: xrsxlnx
  how do i pass duplicates in my range iterator? pseudo 3 2,395 Dec-18-2019, 03:01 PM
Last Post: ichabod801
  Deleting duplicates in tuples Den 2 2,782 Dec-14-2019, 10:32 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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