[Solved] Python: How to cut a string up and use parts of it and discard others [closed]


originalString = 'bpy.types.object.location.* std:label -1 editors/3dview/object/properties/transforms.html#bpy-types-object-location Transform Properties'

# this separates your string by spaces
split = originalString.split(' ') 

# first element is ready to go!
first_element = split[0] # 'bpy.types.object.location.*'

# second element needs to be cut at "#"
second_element = split[3] 
second_element = second_element[:second_element.find('#')] # editors/3dview/object/properties/transforms.html

# now you have your desired output
output = tuple(first_element, second_element)

solved Python: How to cut a string up and use parts of it and discard others [closed]