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 6199227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:09:09+00:00 2026-05-24T04:09:09+00:00

I got a good answer before for a similar problem but I didnt consider

  • 0

I got a good answer before for a similar problem but I didnt consider the scalability of the question that I asked. I had trouble with the text editor I am using concerning pasting in large amounts of text and ending up with either newlines, or if I remove all the newlines from the document then the text goes off the screen and wont allow me to scroll to the end. So I saw how to use open on the text as a file but now the code wont work properly.
Here is the code:

import sys 
import os
from collections import Counter
def main():
    with open('garbledText.txt') as text:
        print [k for k,v in Counter(text).items() if v<3]
if __name__=='__main__':
    main()

it seemed like it was going in the right direction because if I change ‘v<3’ to ‘v<1’ I get an empty list, but with ‘v<3’ I get all the chars.
what I am trying to do is parse the ‘garbledText.txt’ to find chars that appear 1-2 times.

  • 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-05-24T04:09:10+00:00Added an answer on May 24, 2026 at 4:09 am

    replace text for text.read(), the first make a collection of lines and the second of caracters.

    from collections import Counter
    
    def main():
        with open('garbledText.txt') as text:
            collection = Counter(text.read())
        print [char for char, times in collection.items() if times < 3]
    
    if __name__=='__main__':
        main()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I asked a similar question before, and got some good answers, but I think
This question I have asked before and just got answer that there is an
In another question that i asked recently i got a really good answer and
I asked a similar question before only to later discover that what I thought
There is a similar question going around, but it just got the same old
This question has been asked here before, but the author wasn't very clear and
I have touched on this question in others before but after writing an answer
In another question I posted yesterday, I got very good advice on how a
Good evening I've got a little problem with my DataGridView in a .NET Windows
Firstly, I realise that this is a very similar question to this one: Which

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.