Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple csv files
#3
No, unfortunately we can't use any of the modules. I think your suggestion about reading one file at a time will make most sense.

At the moment I'm struggling to find a way to loop through the multiple files and take info from a specific cell. I've managed to do this for one of the files ok using the code below but can't work out how to adapt this to loop through all of the files I need:

andrewfile = open("results/expAAndrew12062013164623.csv", "r")
alllines = andrewfile.readlines()
all_lines = alllines[0].strip(" ").split(",")
print(all_lines)

newfile = open("combinedfile.csv","a")
newfile.write("\n"+all_lines[0])

A lot of the other data has a restricted number of variants or sits under column headings so should be ok with those I think.
Reply


Messages In This Thread
Multiple csv files - by beginner - Nov-03-2018, 12:11 PM
RE: Multiple csv files - by ichabod801 - Nov-03-2018, 01:54 PM
RE: Multiple csv files - by beginner - Nov-03-2018, 04:02 PM
RE: Multiple csv files - by ichabod801 - Nov-03-2018, 06:16 PM

Forum Jump:

User Panel Messages

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