約 22,200,000 件の結果
リンクを新しいタブで開く
  1. How can I determine a Python variable's type? - Stack Overflow

    Python doesn't have such types as you describe. There are two types used to represent integral values: int, which corresponds to platform's int type in C, and long, which is an arbitrary …

  2. How to specify multiple types using type-hints - Stack Overflow

    2025年9月20日 · I have a function in python that can either return a bool or a list. Is there a way to specify the types using type hints? For example, is this the correct way to do it? def foo (id) -> …

  3. python - Immutable vs Mutable types - Stack Overflow

    2011年11月9日 · Mutable types can be changed in place. Immutable types can not change in place. That's the way python sees the world. It is regardless of how variables are passed to …

  4. What's the canonical way to check for type in Python?

    2014年8月3日 · In Python, you can use the built-in isinstance() function to check if an object is of a given type, or if it inherits from a given type. To check if the object o is of type str, you would …

  5. python - What encoding does open () use by default? - Stack …

    The default UTF-8 encoding of Python 3 only extends to conversions between bytes and str types. open() instead chooses an appropriate default encoding based on the environment: encoding is …

  6. python - What are iterator, iterable, and iteration? - Stack Overflow

    So an iterable is an object that you can get an iterator from. An iterator is an object with a next (Python 2) or __next__ (Python 3) method. Whenever you use a for loop, or map, or a list …

  7. python - How should I use the Optional type hint? - Stack Overflow

    Side note: Unless your code only has to support Python 3.9 or newer, you want to avoid using the standard library container types in type hinting, as you can't say anything about what types they …

  8. How to set the python type hinting for a dictionary variable?

    2018年10月1日 · User-defined types are typically pascal case. Python likely derived this naming scheme from C or C++. In C structs are typically lower case (though there are a lot of people …

  9. types - How do you set a conditional in python based on datatypes ...

    I know you can check datatypes in python, but how can you set a conditional based on the datatype? For instance, if I have to write a code that sorts through a dictionary/list and adds up …

  10. python - Determine the type of an object? - Stack Overflow

    2010年2月9日 · There are two built-in functions that help you identify the type of an object. You can use type() if you need the exact type of an object, and isinstance() to check an object’s type …