Python Forum
Picking out integers from a non-list variable
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Picking out integers from a non-list variable
#2
>>> source = 123456
>>> list(str(source))
['1', '2', '3', '4', '5', '6']
>>> str(source)[0]
'1'
>>>
Reply


Messages In This Thread
RE: Picking out integers from a non-list variable - by Mekire - Dec-22-2017, 04:25 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Mediapipe. Not picking up second variable stevolution2024 1 342 Mar-31-2024, 05:56 PM
Last Post: stevolution2024
  No matter what I do I get back "List indices must be integers or slices, not list" Radical 4 1,382 Sep-24-2023, 05:03 AM
Last Post: deanhystad
  Response.json list indices must be integers or slices, not str [SOLVED] AlphaInc 4 6,763 Mar-24-2023, 08:34 AM
Last Post: fullytotal
Question How to append integers from file to list? Milan 8 1,629 Mar-11-2023, 10:59 PM
Last Post: DeaD_EyE
  Error "list indices must be integers or slices, not str" dee 2 1,616 Dec-30-2022, 05:38 PM
Last Post: dee
  read a text file, find all integers, append to list oldtrafford 12 3,975 Aug-11-2022, 08:23 AM
Last Post: Pedroski55
  Split string using variable found in a list japo85 2 1,402 Jul-11-2022, 08:52 AM
Last Post: japo85
  TypeError: list indices must be integers or slices, not range Anldra12 2 2,802 Apr-22-2022, 10:56 AM
Last Post: Anldra12
  An IF statement with a List variable dedesssse 3 8,683 Jul-08-2021, 05:58 PM
Last Post: perfringo
  User input/picking from a list AnunnakiKungFu 2 2,423 Feb-27-2021, 12:10 AM
Last Post: BashBedlam

Forum Jump:

User Panel Messages

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