Python Forum
isolating part of elemnnt in a list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
isolating part of elemnnt in a list
#2
Need to get the 0 index of the first list and the 0 index of the inner list to be able to use split on '1 A'.
>>> my_list = [['1 A'], ['2 B']]
>>> a, b = my_list[0][0].split()
>>> my_list[0][0] = '{} {}'.format(int(a)+10, b)
>>> my_list
[['11 A'], ['2 B']]
>>>
Reply


Messages In This Thread
isolating part of elemnnt in a list - by trepaning - Oct-29-2016, 04:06 PM
RE: isolating part of elemnnt in a list - by Yoriz - Oct-29-2016, 04:31 PM
RE: isolating part of elemnnt in a list - by buran - Oct-29-2016, 04:33 PM
RE: isolating part of elemnnt in a list - by Yoriz - Oct-29-2016, 08:49 PM
RE: isolating part of elemnnt in a list - by Yoriz - Oct-29-2016, 09:51 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Adding List Element if Second part of the List Elements are the Same quest_ 3 2,528 Nov-25-2020, 04:33 PM
Last Post: bowlofred
  Select a part of an element of a list with Index BollerwagenIng 0 1,886 Aug-09-2019, 09:27 AM
Last Post: BollerwagenIng

Forum Jump:

User Panel Messages

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