Python Forum
AttributeError: module 'string' has no attribute 'uppercase'
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AttributeError: module 'string' has no attribute 'uppercase'
#11
At last I read the whole assignment and now I see you did exactly what you should do. Thumbs Up
And indeed you need to delete certain items from the dictionary afterwards. But you cannot delete them in the same loop. So the solution would be to fill a list of the keys that need to be deleted in the loop "for word, count in freq.items():".
After that loop you start a new loop over the "to_be_deleted" list. In that loop you can delete the items from the dictionary.
Reply


Messages In This Thread
RE: AttributeError: module 'string' has no attribute 'uppercase' - by ibreeden - Apr-23-2021, 05:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  trouble reading string/module from excel as a list popular_dog 0 418 Oct-04-2023, 01:07 PM
Last Post: popular_dog
  getpass.getpass() results in AttributeError: module 'os' has no attribute 'O_NOCTTY' EarthAndMoon 4 765 Oct-03-2023, 02:00 PM
Last Post: deanhystad
  AttributeError: '_tkinter.tkapp' object has no attribute 'username' Konstantin23 4 1,674 Aug-04-2023, 12:41 PM
Last Post: Konstantin23
  Parallel processing - AttributeError: Can't get attribute 'sktimekmeans' Mohana1983 1 748 Jun-22-2023, 02:33 AM
Last Post: woooee
  Python: AttributeError: 'PageObject' object has no attribute 'extract_images' Melcu54 2 3,872 Jun-18-2023, 07:47 PM
Last Post: Melcu54
  cx_oracle Error - AttributeError: 'function' object has no attribute 'cursor' birajdarmm 1 2,337 Apr-15-2023, 05:17 PM
Last Post: deanhystad
  File "<string>", line 19, in <module> error is related to what? Frankduc 9 12,551 Mar-09-2023, 07:22 AM
Last Post: LocklearSusan
  Pandas AttributeError: 'DataFrame' object has no attribute 'concat' Sameer33 5 5,597 Feb-17-2023, 06:01 PM
Last Post: Sameer33
  AttributeError: 'numpy.ndarray' object has no attribute 'load' hobbyist 8 7,110 Jul-06-2022, 10:55 AM
Last Post: deanhystad
  AttributeError: 'numpy.int32' object has no attribute 'split' rf_kartal 6 4,372 Jun-24-2022, 08:37 AM
Last Post: Anushka00

Forum Jump:

User Panel Messages

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