I'm trying to write a generic script, part of which imports files that are either comma-separated or white-space-separated. I'd like the script to recognize either type. Is there a way to specify something like
arrayobj = np.genfromtxt(file.txt, delimiter=(',' OR '\t'), names=None, dtype=None)
I tried using a regular expression (',|\t'
) but that doesn't work either.