Python Forum
Read file Into array with just $0d as Newline
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Read file Into array with just $0d as Newline
#1
I have a Textfile that contains several Lines, but just contains $0d as new Line instead of $0d $0a

When i load this into a List with

	with open(filename)as f:
		lines =f.readlines()
	print(lines)
The result is a list (lines) which contains just one Item which looks like :

"8890 \r11.19.19\rGRIDDYP-+1D/EX\rPRG\r46 \r8890 \r11.19.19\rTESTFILE2018\rPRG\r132 \r8890 \r11.19.19\rTESTFILE2019\rPRG\r132"

But how do i convert this to an array which uses the \r as splitter ? or how to read this onto an array with just $0d as new line Indicator ?
Reply


Messages In This Thread
Read file Into array with just $0d as Newline - by lastyle - Feb-02-2020, 10:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pandas read csv file in 'date/time' chunks MorganSamage 4 1,709 Feb-13-2023, 11:24 AM
Last Post: MorganSamage
  Can't read text file with pandas zinho 6 12,138 May-24-2020, 06:13 AM
Last Post: azajali43
  Read json array data by pandas vipinct 0 1,956 Apr-13-2020, 02:24 PM
Last Post: vipinct
  Read csv file from Yahoo Finance ian 3 4,664 Sep-22-2019, 06:47 AM
Last Post: ndc85430
  read complex file with both pandas and not Diedro 1 2,899 Jan-29-2019, 05:26 PM
Last Post: Larz60+
  read from txt. file in certain manner SchroedingersLion 13 7,488 Aug-07-2018, 04:14 PM
Last Post: SchroedingersLion
  save 2d array to file and load back ian 3 18,297 May-18-2018, 05:00 AM
Last Post: scidam
  loading a 3D array from a bin file Mark3232 1 4,724 May-04-2018, 11:36 AM
Last Post: j.crater
  access a very large file? As an array or as a dataframe? Angelika 5 4,935 May-18-2017, 08:15 AM
Last Post: Angelika
  Need help in framing data read from wav file Vishweshkumar 1 3,676 Feb-10-2017, 01:45 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020