I know how to import a individual file

def cvt(s,default=-1):
        return float(s)
    except ValueError:
        return default

import csv
with open("Dealer1.txt", "rb") as csvfile:
    reader = csv.reader(csvfile, delimiter="\t")
    data = list(reader)

I have a folder that contains 50+ files, using Glob, I created the following code

import os
import glob

files = glob.glob('*.txt')
print files

Now is there a way that instead of me importing individual files I can actual import all 50 files data at the same time, all 50 have the same layout can I import all the data from the txt files in one go


csvfile = fileinput.input(glob.glob('*.txt')) may work.