I have a script where I do some magic stuff to dynamically load a module, and instantiate the first class found in the module. But I can't use types.ClassType
anymore in Python 3. What is the correct way to do this now?
相关问题
- Django __str__ returned non-string (type NoneType)
- What uses more memory in c++? An 2 ints or 2 funct
- How to postpone/defer the evaluation of f-strings?
- ImportError shows up with py.test, but not when ru
- Comparing pd.Series and getting, what appears to b
相关文章
- Airflow depends_on_past explanation
- Raspberry Pi-Python: Install Pandas on Python 3.5.
- How do I get from a type to the TryParse method?
- Numpy array to TFrecord
- How to split a DataFrame in pandas in predefined p
- Error following env.render() for OpenAI
- AttributeError: 'Series' object has no att
- Java Generics: How to specify a Class type for a g
It was used for classic classes. In Python 3 they're gone. I suppose you could use something like:
I figured it out. It seems that classes are of type "type". Here is an example of how to distinguish between classes and other objects at runtime.