About 660,000 results
Open links in new tab
  1. How to get all of the "ids" within a python array - Stack Overflow

    Aug 17, 2016 · ids = [] for elem in data['result']['elements']: ids.append(elem['id']) If you want to evaluate this lazily, make a generator comprehension! ids = (element['id'] for element in data['result']['elements'])

  2. Python Arrays - W3Schools

    Note: Python does not have built-in support for Arrays, but Python Lists can be used instead. Note: This page shows you how to use LISTS as ARRAYS, however, to work with arrays in Python you will have to import a library, like the NumPy library. Arrays are used to store multiple values in one single variable: Create an array containing car names:

  3. python - Check if item is in an array / list - Stack Overflow

    Assuming your list of strs is called subjects: # whatever. Use a lambda function. Let's say you have an array: Check whether 5 is in nums in Python 3.X: Check whether 5 is in nums in Python 2.7: This solution is more robust. You can now check whether any number satisfying a certain condition is in your array nums.

  4. Python: can I have a list with named indices? - Stack Overflow

    Sep 3, 2016 · PHP arrays are actually maps, which is equivalent to dicts in Python. Thus, this is the Python equivalent: showlist = [{'id':1, 'name':'Sesaeme Street'}, {'id':2, 'name':'Dora the Explorer'}]

  5. Difference between List and Array in Python - GeeksforGeeks

    Aug 21, 2024 · In Python, lists and arrays are the data structures that are used to store multiple items. They both support the indexing of elements to access them, slicing, and iterating over the elements. In this article, we will see the difference between the two.

  6. Arrays In Python: The Complete Guide With Practical Examples

    Arrays are one of the fundamental data structures in programming, and Python offers several ways to work with them. When I first started working with Python more than a decade ago, understanding arrays was a game-changer for handling collections of data efficiently.

  7. Python Arrays - GeeksforGeeks

    Mar 11, 2025 · Array in Python can be created by importing an array module. array ( data_type , value_list ) is used to create array in Python with data type and value list specified in its arguments. Elements can be added to the Python Array by using built-in insert () function. Insert is used to insert one or more data elements into an array.

  8. Python Lists - GeeksforGeeks

    Mar 11, 2025 · In Python, a list is a built-in dynamic sized array (automatically grows and shrinks). We can store all types of items (including another list) in a list.

  9. Array vs. List in Python – What's the Difference?

    Dec 17, 2019 · Both lists and arrays are used to store data in Python. Moreover, both data structures allow indexing, slicing, and iterating. So what's the difference between an array and a list in Python? In this article, we'll explain in detail when to use a Python array vs. a list.

  10. python - Retrieving from list of objects by id - Stack Overflow

    id!='obj1'and id!='obj2' returns true which equals 1 in Python, that is to say, c=list1[id!='obj1'and id!='obj2':] equals c=list1[1:], which of course has two objects. BTW, id is the name of a built-in function. Please avoid using it as a name of varible.

Refresh