1

I was trying to read a tab-delimited text file like this:

1 2# 3

using:

test = genfromtxt('test2.txt', delimiter='\t', dtype = 'string', skip_header=0)

However, I get the output only of 1 and 2. The # acts like an ending character in the txt file. Is there any way to solve this if I want to read the pound sign as a string?

TigerhawkT3
  • 48,464
  • 6
  • 60
  • 97
Alex
  • 1,097
  • 3
  • 11
  • 16

1 Answers1

1

the_string.split('\t') should do the job if you don't have to use genfromtxt

Shane
  • 4,875
  • 12
  • 49
  • 87
  • I have a large data set in the txt file. Here I just use a simple example. I think I have to use getfromtxt here. – Alex Dec 04 '16 at 07:13