Bottom Page

Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 How to find previous string of a string
#2
Explore string slicing. See what the below gives you (the literal string can be replaced by a variable).

"Mary had a little lamb"[:10]

So, you can find where the string you are looking for starts, and then slice the string to return everything before that.
You like this post
I am trying to help you, really, even if it doesn't always seem that way
Quote

Top Page

Messages In This Thread
RE: How to find previous string of a string - by gruntfutuk - Sep-26-2018, 02:31 PM

Possibly Related Threads...
Thread Author Replies Views Last Post
  Use String contents for checkbox name jcday 1 45 1 hour ago
Last Post: Larz60+
  How to get the index of a character from a string chihaya 1 78 Dec-03-2019, 12:54 PM
Last Post: buran
  Strange Characters in JSON returned string fioranosnake 4 122 Dec-02-2019, 07:25 PM
Last Post: fioranosnake
  type of object as a string Skaperen 1 71 Dec-02-2019, 08:01 AM
Last Post: midarq
  Python C API - Issue with string as arugments JRHeisey 2 119 Nov-30-2019, 04:53 AM
Last Post: casevh
  Error in the code ->ValueError: could not convert string to float: ' ' eagleboom 1 176 Nov-29-2019, 06:19 AM
Last Post: ThomasL
  Extract email addresses from string and store them in a list oslosurfer 2 92 Nov-24-2019, 03:35 PM
Last Post: oslosurfer
  Unicode string index problem luoheng 6 150 Nov-23-2019, 03:04 PM
Last Post: luoheng
  First Byte of a string is missing while receiving data over TCP Socket shahrukh1987 3 145 Nov-20-2019, 10:34 AM
Last Post: shahrukh1987
  line number of first and second occurance of string in a file mdalireza 1 86 Nov-18-2019, 09:55 AM
Last Post: perfringo

Forum Jump:


Users browsing this thread: 1 Guest(s)