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
#6
As that string has extra double quotes,can do tricks and match between quotes.
For testing regex look at regex101.
There also a Regular Expression HOWTO and the regular doc.
>>> import re
>>> 
>>> line2 = '"555 102 4 21", "39 555 6", "555 102"'
>>> r = re.findall(r'"(.*?)"', line2)
>>> r
['555 102 4 21', '39 555 6', '555 102']

>>> r[0]
'555 102 4 21'
>>> [int(i) for i in r[0].split()]
[555, 102, 4, 21]
>>> # Or think of why this work,hint new PEP
>>> g = r[0].replace(' ', '_')
>>> g
'555_102_4_21'
>>> int(g)
555102421

# No error using underscore in integer
>>> 100_000_000_123
100000000123
Reply


Messages In This Thread
RE: fastest way to record values between quotes - by snippsat - Apr-15-2019, 01:51 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Fastest way tkinter Quatrixouuu 2 420 Feb-19-2024, 07:20 AM
Last Post: Danishhafeez
  Last record in file doesn't write to newline gonksoup 3 456 Jan-22-2024, 12:56 PM
Last Post: deanhystad
  How do I stream and record at the same time with arducam? traderjoe 0 475 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,096 May-26-2023, 04:41 AM
Last Post: Gribouillis
  Fastest Way of Writing/Reading Data JamesA 1 2,208 Jul-27-2021, 03:52 PM
Last Post: Larz60+
  Two types of single quotes Led_Zeppelin 2 1,923 Mar-15-2021, 07:55 PM
Last Post: BashBedlam
  Only getting last record saved...Why Milfredo 10 4,399 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,821 Aug-03-2020, 02:47 PM
Last Post: Zhaleh
  Fastest Method for Querying SQL Server with Python Pandas BuJayBelvin 7 6,941 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