I have the following file TSV file p.txt containing a single line of 3 values:

"22p" "22o" "22u"

(The actual files are many lines, i.e. 2D, but I'm sticking to this minimum example)

Using either Import["p.txt", "TSV"] or Import["p.txt", "Table"] produces the same unintended output of:

{{22, "22o", "22u"}}

I.e. the first entry is falsely interpreted as a value and the letter "p" is removed. I would like to have every entry interpreted as a string. How to achieve this?

I know how to do it using the ReadList command. But I probably cannot use it as I rely on the CharacterEncoding->"Unicode" option of Import for the data files. If there is another way to resepct the files Byte Encoding, I could also use ReadList.


1 Answer 1


Disable automatic conversion to numbers:

Import["p.txt", "Table", "Numeric" -> False]

(* {{"22p", "22o", "22u"}} *)
  • $\begingroup$ Thanks again. I wish some of those things were documented better. But probably impossible looking at the huge number of options present in Mathematica. $\endgroup$
    – tobalt
    Jan 3 at 12:56
  • 3
    $\begingroup$ Yes, Import is a very general function, and you have to look into the documentation of the format, such as "Table". $\endgroup$
    – Domen
    Jan 3 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.