Python Forum
fastest way to record values between quotes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
fastest way to record values between quotes
#1
Dear All,

I've not been using Python for years (I'm rather a matlab user), But I've the opportunity to work with it again. Blush

The goal is to deal with Ascii files, containing different types of data; I'm wondering how to improve the code here after in order to record specific numbers between quotes, especially can I avoid (hugly) loop use?

Thanks for any advice

Paul
t0 = time.time()
line1 = '"tel 555-669", "duration 6", "number 2.", "Price 3.58"'
quote = re.finditer('"',line1)
position_quote = []
for match_quote in quote:
    position_quote.append(match_quote.span())

Price = float(line1[position_quote[6][0]+7 : position_quote[7][0]-1])
t1 = time.time()
print("Duration : ", t1-t0)
Reply


Messages In This Thread
fastest way to record values between quotes - by paul18fr - Apr-14-2019, 04:06 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Fastest way tkinter Quatrixouuu 2 418 Feb-19-2024, 07:20 AM
Last Post: Danishhafeez
  Last record in file doesn't write to newline gonksoup 3 454 Jan-22-2024, 12:56 PM
Last Post: deanhystad
  How do I stream and record at the same time with arducam? traderjoe 0 472 Oct-23-2023, 12:01 AM
Last Post: traderjoe
  What is the fastest way to get all the frames from a video file? glorsh66 3 1,094 May-26-2023, 04:41 AM
Last Post: Gribouillis
  Fastest Way of Writing/Reading Data JamesA 1 2,207 Jul-27-2021, 03:52 PM
Last Post: Larz60+
  Two types of single quotes Led_Zeppelin 2 1,922 Mar-15-2021, 07:55 PM
Last Post: BashBedlam
  Only getting last record saved...Why Milfredo 10 4,398 Sep-10-2020, 03:00 AM
Last Post: Milfredo
  Quotes vs. no quotes around numbers Mark17 6 3,166 Aug-06-2020, 04:13 AM
Last Post: t4keheart
  how can we record a video file from our program output (moving object) Zhaleh 0 1,819 Aug-03-2020, 02:47 PM
Last Post: Zhaleh
  Fastest Method for Querying SQL Server with Python Pandas BuJayBelvin 7 6,940 Aug-02-2020, 06:21 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

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