Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8835277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:13:24+00:00 2026-06-14T09:13:24+00:00

I want to have a dict(tuple(int, Counter)). variable = defaultdict(int,Counter) TypeError: descriptor ‘keys’ of

  • 0

I want to have a dict(tuple(int, Counter)).

    variable = defaultdict(int,Counter)
    TypeError: descriptor 'keys' of 'dict' object needs an argument

I have IP addresses that can be associated with multiple values, such as a ttl value and MAC addresses, so I want to count which ttl value appears the most, and I want to associate it (via the int) with the other ttl values.

How do I declare this type?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:13:25+00:00Added an answer on June 14, 2026 at 9:13 am

    Use a lambda as the defaultdict initializer

     variable = defaultdict(lambda : (int(), Counter()))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have python dict object with key as datetime.date object and values as tuple
I have a dict with tuples as keys, and I want to obtain the
I want to have sum of values in a dict. Below is the code
how join tuple list a dict? this is what i have: [('a','b'),('c','d'),('e','f')] and this
I want to have dict / list to which I can add values, just
I have a dict of this form... d={'s1':{'a':[1,2,3],'b':[4,5,6]},'s2':{'d':[77,88,99],'e':[666,333,444]}} so i want to print in
I have a dict that I want to convert in JSON using simplejson. How
I have a dict that has many elements, I want to write a function
I want to have a bound form from an object to use the is_valid
I have a dict that has string-type keys whose exact values I can't know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.