Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
factorise split
#3
Thanks !
In fact I want to find value 64 (from 64%) with my split


(Nov-02-2020, 01:41 PM)perfringo Wrote: With information provided I don't see how it can be 'working'.

>>> reason = 'test STATE (64/100)(64%) test1 test2.....'
>>> reason.split(' ')[3]
'test1'


Next split on this string would be on ( which is not present, so there will be no split and as Python will be looking for item with indice 2 it will raise IndexError.

>>> _.split('(')
['test1']
Reply


Messages In This Thread
factorise split - by enigma619 - Nov-02-2020, 12:44 PM
RE: factorise split - by perfringo - Nov-02-2020, 01:41 PM
RE: factorise split - by enigma619 - Nov-02-2020, 01:48 PM
RE: factorise split - by DeaD_EyE - Nov-02-2020, 01:50 PM
RE: factorise split - by enigma619 - Nov-03-2020, 08:28 AM

Forum Jump:

User Panel Messages

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