Importing variables from another file in Python

Everything you’ve done is right except when using the variables. In your main_file.py file: (Or) Use the following header : (Or) Replace all the references of flag and j (or any other variable you want to use from that file) with the prefix ‘variables.’ Since this is just a copy of the variable, the values … Read more

TypeError : Unhashable type

I am trying to get a list of list of tuples : something like [ [(1,0),(2,0),(3,0)],[(1,1),(2,1),(3,1)….]] I used this statement But it gives me an error I have 2 questions for the Python Guru’s: a) When I look at the Python definition of Hashable – “An object is hashable if it has a hash value which never … Read more

How to turn on line numbers in IDLE?

Version 3.8 or newer: To show line numbers in the current window, go to Options and click Show Line Numbers. To show them automatically, go to Options > Configure IDLE > General and check the Show line numbers in new windows box. Version 3.7 or older: Unfortunately there is not an option to display line numbers in IDLE although there is an enhancement request open for this. However, … Read more

‘pip install’ fails for every package (“Could not find a version that satisfies the requirement”) [duplicate]

Upgrade pip as follows: Note: You may need to use sudo python above if not in a virtual environment. What’s happening: Python.org sites are stopping support for TLS versions 1.0 and 1.1. This means that Mac OS X version 10.12 (Sierra) or older will not be able to use pip unless they upgrade pip as above. (Note that upgrading pip via pip … Read more

How to downgrade python from 3.7 to 3.6

I’m trying to install tensorflow but it needs a Python 3.6 installation and I only have Python 3.7 installed. I tried to switch using brew and pyenv but it doesn’t work. Does anyone know of a way to solve this problem?