Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Grabbing a Subset of a String
#4
If structure of strings is similar then one can achieve desired result also without re

>>> s = "Call Loc/Folder/(555) 555-5555 - 2/27/2019 8:52:34 AM/RoomB"
>>> " ".join(s.rsplit("/", maxsplit=1)[0].rsplit(maxsplit=3)[-3:])
'2/27/2019 8:52:34 AM'
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.
Quote

Top Page

Messages In This Thread
Grabbing a Subset of a String - by acemurdoc - Jun-18-2019, 02:22 PM
RE: Grabbing a Subset of a String - by ichabod801 - Jun-18-2019, 02:26 PM
RE: Grabbing a Subset of a String - by acemurdoc - Jun-18-2019, 02:38 PM
RE: Grabbing a Subset of a String - by perfringo - Jun-18-2019, 04:57 PM

Possibly Related Threads...
Thread Author Replies Views Last Post
  Grabbing a value from one python script into another nickayres 3 471 May-24-2019, 08:21 PM
Last Post: snippsat
  Grabbing questions from a quiz app CodingUnicorn 0 390 Mar-05-2019, 11:26 PM
Last Post: CodingUnicorn

Forum Jump:


Users browsing this thread: 1 Guest(s)