Python Forum
read from txt. file in certain manner
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
read from txt. file in certain manner
#1
Greetings,

I just found this website that summarizes how to read from a .txt file:
https://www.guru99.com/reading-and-writi...ython.html

It only gives the options of reading the entire content or reading line by line.

Now I have to plot (x,y) data that is stored in a .txt file in two columns (one column for the x-, one columns for the y-values). The columns are merely separated by a few spaces. I want to store the x values in one array/list and the y values in another.

I am a complete Python beginner and I intend to work with Matplotlib later on for the actual plotting. However, to plot something I probably have to read in the data first, so here we are.

Regards!
Reply


Messages In This Thread
read from txt. file in certain manner - by SchroedingersLion - Aug-06-2018, 02:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pandas read csv file in 'date/time' chunks MorganSamage 4 1,806 Feb-13-2023, 11:24 AM
Last Post: MorganSamage
  Can't read text file with pandas zinho 6 12,276 May-24-2020, 06:13 AM
Last Post: azajali43
  Read file Into array with just $0d as Newline lastyle 5 3,467 Feb-03-2020, 11:58 PM
Last Post: lastyle
  Read csv file from Yahoo Finance ian 3 4,762 Sep-22-2019, 06:47 AM
Last Post: ndc85430
  read complex file with both pandas and not Diedro 1 2,974 Jan-29-2019, 05:26 PM
Last Post: Larz60+
  Need help in framing data read from wav file Vishweshkumar 1 3,732 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