So I have a really long text document (10 million lines) and I want to convert that document to an array. For example, my text document is:
a
b
c
and I want to convert this to:
["a","b","c"]
How can I do that?
First read document as plain text and use split
method with split character '\n'
. This will split your document on new lines.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.