# Importing numbers form a text file with a semicolon separator

I have a list of numbers separated by semicolon in text file and I would like to import the data and work with them. If I use

data = ReadList["file",Word,WordSeparators -> ";"] /. Word -> Number


it gives me word or string instead of number. What can I do?

• ToExpression@ ReadList["file",Word,WordSeparators -> ";"] ?
– kglr
Jun 1 '17 at 21:26
• or ReadList["file", "Number", "RecordSeparators" -> {";"}]?
– kglr
Jun 1 '17 at 21:30
• ImportString[ StringReplace[Import[ file , "Text"] , ";" -> ","] , "CSV"] maybe. (also caution ToExpression wont work if any of the numbers are in E exponent form ) Jun 1 '17 at 22:08

## 1 Answer

file = StringToStream["1;2;3;4.5;5.5;6.5"];
ReadList[file, Number, RecordSeparators -> {";"}]


{1, 2, 3, 4.5, 5.5, 6.5}