Skip to content
Advertisement

How do I print name of array in Python?

I have few arrays, in my code. I wanna be able to change, which I am using in one place, and to be able to print name of it only changing one line (definition).

Example:

JavaScript

Now I want to have in print being to able call XYZ array not my_array. So I don’t have to change it twice, but It will show the same output.

How do I that?

Advertisement

Answer

you can use a class to store the array and the name, then you can access with .name o .array

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement