About 20,100,000 results
Open links in new tab
  1. What's the difference between lists and tuples? - Stack Overflow

    Dec 9, 2024 · The PEP 484 -- Type Hints says that the types of elements of a tuple can be individually typed; so that you can say Tuple[str, int, float]; but a list, with List typing class can …

  2. python - What is a tuple useful for? - Stack Overflow

    Sep 9, 2014 · A tuple is a good way to pack multiple values into that cookie without having to define a separate class to contain them. I try to be judicious about this particular use, though. …

  3. How does tuple comparison work in Python? - Stack Overflow

    Tuples are compared position by position: the first item of the first tuple is compared to the first item of the second tuple; if they are not equal (i.e. the first is greater or smaller than the …

  4. python - Convert numpy array to tuple - Stack Overflow

    Apr 5, 2012 · Note: This is asking for the reverse of the usual tuple-to-array conversion. I have to pass an argument to a (wrapped c++) function as a nested tuple. For example, the following …

  5. types - What are "named tuples" in Python? - Stack Overflow

    Jun 4, 2010 · It's a specific subclass of a tuple that is programmatically created to your specification, with named fields and a fixed length. This, for example, creates a subclass of …

  6. python - Add another tuple to a tuple of tuples - Stack Overflow

    Build another tuple-of-tuples out of another_choice, then concatenate: final_choices = (another_choice,) + my_choices Alternately, consider making my_choices a list-of-tuples …

  7. What does the term "Tuple" Mean in Relational Databases?

    Apr 15, 2009 · A tuple is used to define a slice of data from a cube; it is composed of an ordered collection of one member from one or more dimensions. A tuple is used to identify specific …

  8. parsing - Python casting Tuple [int, int] - Stack Overflow

    Apr 19, 2019 · I have a string "1,2" that I am trying to parse into (1, 2) without simply splitting based on ,. I was thinking intuitively something along the lines of: from typing import Tuple t = …

  9. floating point - How can I convert a tuple to a float in python ...

    Dec 9, 2013 · A tuple is a sequence, just like a list, or any other kind of sequence. So, you can index it: >>> a = struct.unpack('f', 'helo') >>> b = a[0] >>> b 7.316105495173273e+28

  10. AttributeError: 'tuple' object has no attribute - Stack Overflow

    Mar 3, 2014 · This is what is called a tuple, obj is associated with 4 values, the values of s1,s2,s3,s4. So, use index as you use in a list to get the value you want, in order. …