Python Forum
python3 List to array or string to extract data
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python3 List to array or string to extract data
#4
(May-28-2019, 12:39 PM)buran Wrote: what you have is tuple with one element list, that list has one element - list. Now that list has many elements - lists
>>> foo = ([[[32.098659, 34.826334], [32.099361, 34.830506], [32.097026, 34.831574], [32.095502, 34.827881]]],)
>>> type(foo)
<class 'tuple'>
>>> foo[0]
[[[32.098659, 34.826334], [32.099361, 34.830506], [32.097026, 34.831574], [32.095502, 34.827881]]]
>>> type(foo[0])
<class 'list'>
>>> foo[0][0]
[[32.098659, 34.826334], [32.099361, 34.830506], [32.097026, 34.831574], [32.095502, 34.827881]]
>>> type(foo[0][0])
<class 'list'>
>>> foo[0][0][0]
[32.098659, 34.826334]
>>> type(foo[0][0][0])
<class 'list'>
>>> foo[0][0][0][0]
32.098659
>>>

Hey, Thanks for the quick answers, it doesn't work for me from the code, if i do python3 on terminal and doing your commandes it does work but, from the code it doesn't.
maybe its because i forgot to mention i do :
    poly = list(poly)
in another section before that one ?

this is what i get when i run it through test.py code:

    print("POLYYY", poly[0][0][0])
            print(type(poly))

       [1], INF, POLYYY (32.098659,)
       [1], INF, <class 'list'>
Thanks
Reply


Messages In This Thread
RE: python3 List to array or string to extract data - by batchenr - May-28-2019, 01:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with to check an Input list data with a data read from an external source sacharyya 3 537 Mar-09-2024, 12:33 PM
Last Post: Pedroski55
  Python3 string slicing Luchano55 4 711 Feb-17-2024, 09:40 AM
Last Post: Pedroski55
  Is it possible to extract 1 or 2 bits of data from MS project files? cubangt 8 1,217 Feb-16-2024, 12:02 AM
Last Post: deanhystad
  extract substring from a string before a word !! evilcode1 3 628 Nov-08-2023, 12:18 AM
Last Post: evilcode1
  Why can't it extract the data from .txt well? Melcu54 3 732 Aug-20-2023, 10:07 PM
Last Post: deanhystad
Question Need help for a python script to extract information from a list of files lephunghien 6 1,193 Jun-12-2023, 05:40 PM
Last Post: snippsat
  extract only text strip byte array Pir8Radio 7 3,125 Nov-29-2022, 10:24 PM
Last Post: Pir8Radio
  Extract value from a list thesquid 2 907 Nov-29-2022, 01:54 PM
Last Post: thesquid
  python Extract sql data by combining below code. mg24 1 1,008 Oct-03-2022, 10:25 AM
Last Post: mg24
  SQL Alchemy help to extract sql data into csv files mg24 1 1,890 Sep-30-2022, 04:43 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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