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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:20:42+00:00 2026-06-12T22:20:42+00:00

Thanks for the help so far! I got up to this point in the

  • 0

Thanks for the help so far! I got up to this point in the code.

import glob
import csv
import sys
import array

x=1
signs=array.array('i',(0,)*31) 
files = glob.glob('./*.csv')
file = open("all.csv", 'w') 

for row in files: 
    if x<30: 
        signs[x]= x 
        x=x+1 

print (signs[x])
file.close()

I have problems with printing the whole array. As I said, There are 29 files with 30 values each in the model :
1,2
2,9
3,20
4,6
5,2
There is no particular order or anything and numbers do repeat themselves. I need to print out the numbers and how many of them have actually repeated themselves. I seem to create the file all.csv but it appears to be empty. I am really new to python please don’t rage at me. I searched for about 8 hours now (including previous code block which I deleted) but I appear to be stuck.

  • 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-12T22:20:44+00:00Added an answer on June 12, 2026 at 10:20 pm

    One option: iterate over each number in each file and increment a counter that is stored in a dictionary. Print out the results sorted by the dictionary keys (which are the numbers encountered in the csv files).

    import csv, glob, sys
    
    from collections import defaultdict
    
    files = [open(f) for f in glob.glob('user./[1-29].csv')]
    #files = [open('input1','r')]
    counts = defaultdict(int)
    
    for f in files:
        r = csv.reader(f)
        for line in r:
            for num in line:
                counts[int(num)] += 1
    
    for key,val in sorted(counts.items()):
        print key, val
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

/edit: thanks for the help so far, however I haven't got any of the
First, thanks for all the help I've received so far from StackOverflow. I've learned
Ok. here's the operations i successfully code so far thank's to your help: Adittion:
C# XNA Xbox, in this case optional parameters are not optional Thanks to help
Thanks to some help I received yesterday I've got some dynamic summing working on
Thanks for any help in advance, I can't wrap my SQL skills around this
I have this code so far: private class DownloadWebPageTask extends AsyncTask<String, Void, String> {
I've got this query so far: if(!empty($_SESSION['s_property_region'])) { $sqlWHERE .= AND $wpdb->postmeta.meta_key = 'property_region'
I have a show/hide toggle working well in multiple instances (thanks to help here
Thanks for the help on here with my query on here the other day

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.