Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
parse String
#3
If the "Data Editor_VDT" value does not contain any special characters, you can easily extract it by splitting the string.

If it's not the right code, let me know and give me more examples of the texts so I can understand your requirements and modify the code.

text = '''<Role name: Data Editor_VDT, description: This type of account is meant for data editors, including mobile/field data collectors. This account cannot create content or groups, but can participate in groups, view VDOT content, and edit data shared with them.>'''

extract_text = text.split(', ')[0].split(': ')[-1]

print(extract_text) # Data Editor_VDT
Reply


Messages In This Thread
parse String - by jaykappy - Dec-22-2022, 02:08 PM
RE: parse String - by Larz60+ - Dec-22-2022, 03:08 PM
RE: parse String - by praveencqr - Dec-23-2022, 07:42 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I parse the string? anna17 4 494 Apr-10-2024, 10:26 AM
Last Post: DeaD_EyE
  [split] Parse Nested JSON String in Python mmm07 4 1,657 Mar-28-2023, 06:07 PM
Last Post: snippsat
  Parse String between 2 Delimiters and add as single list items lastyle 5 3,525 Apr-11-2021, 11:03 PM
Last Post: lastyle

Forum Jump:

User Panel Messages

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