Python Forum
Searching a .txt file for a specific number and extracting the corresponding data
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Searching a .txt file for a specific number and extracting the corresponding data
#3
Do you mean something like that:

>>> d = [
...     [1, 10],
...     [0.6, 20],
...     [2, 30],
...     [0.6, 40]
...     ]
>>> [row[1] for row in d if row[0] == 0.6]
[20, 40]
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
RE: Searching a .txt file for a specific number and extracting the corresponding data - by perfringo - Jul-26-2018, 08:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sorting data by specific variables using argparse Bearinabox 5 1,434 Jan-01-2023, 07:44 PM
Last Post: Bearinabox
  Training a model to identify specific SMS types and extract relevant data? lord_of_cinder 0 986 Oct-10-2022, 04:35 AM
Last Post: lord_of_cinder
  Split excel file and write output at specific row and set sheet position DSCA 0 2,008 May-12-2022, 07:29 PM
Last Post: DSCA
  Searching Module to plot large data G_rizzle 0 1,459 Dec-06-2021, 08:00 AM
Last Post: G_rizzle
  extracting sublist from a large multiple molecular file juliocollm 2 2,316 May-25-2020, 12:49 PM
Last Post: juliocollm
  Import Excel File that Starts with Number kiki1113 1 3,327 Dec-20-2018, 07:13 PM
Last Post: Larz60+
  Extracting specific columns in an array uthongam 1 2,171 Dec-07-2018, 06:06 PM
Last Post: ichabod801
  Write specific rows from pandas dataframe to csv file pradeepkumarbe 3 5,539 Oct-18-2018, 09:33 PM
Last Post: volcano63
  extracting XML data into datframe hey_arnold 2 2,819 Jul-29-2018, 04:48 PM
Last Post: hey_arnold
  How to filter specific rows from large data file Ariane 7 8,253 Jun-29-2018, 02:43 PM
Last Post: gontajones

Forum Jump:

User Panel Messages

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