The whos command in IPython provides a list of all variables currently in the namespace, but it doesn’t directly support filtering. However, you can achieve similar functionality by using Python’s built-in capabilities. Here’s a way to filter variables by type or name:
- Filter by Type: Use a list comprehension to filter variables by their type.
[var for var in globals() if isinstance(globals()[var], YourType)] - Filter by Name: Use a list comprehension to filter variables by name pattern.
[var for var in globals() if 'pattern' in var]
Replace YourType with the desired type (e.g., int, str) and 'pattern' with the substring you want to match in variable names.