Top "Python-3.x" questions

For questions about Python programming that are specific to version 3+ of the language.

Could not find a version that satisfies the requirement tensorflow

I installed the latest version of Python (3.6.4 64-bit) and the latest version of PyCharm (2017.3.3 64-bit). Then I installed some modules …

python python-3.x python-2.7 tensorflow pip
Understanding the main method of python

I am new to Python, but I have experience in other OOP languages. My course does not explain the main …

python python-3.x
How to correct TypeError: Unicode-objects must be encoded before hashing?

I have this error: Traceback (most recent call last): File "python_md5_cracker.py", line 27, in <module> m.…

python python-3.x unicode syntax-error hashlib
Print new output on same line

I want to print the looped output to the screen on the same line. How do I this in the …

python python-3.x printing
Unable to set default python version to python3 in ubuntu

I was trying to set default python version to python3 in Ubuntu 16.04. By default it is python2 (2.7). I followed below …

python python-3.x ubuntu installation ubuntu-16.04
Local (?) variable referenced before assignment

test1 = 0 def testFunc(): test1 += 1 testFunc() I am receiving the following error: UnboundLocalError: local variable 'test1' referenced before assignment. Error …

python python-3.x
Why is there no xrange function in Python3?

Recently I started using Python3 and it's lack of xrange hurts. Simple example: 1) Python2: from time import time as t …

python python-3.x pep xrange
How to convert 'binary string' to normal string in Python3?

For example, I have a string like this(return value of subprocess.check_output): >>> b'a string' b'a …

python string python-3.x binary
How should I read a file line-by-line in Python?

In pre-historic times (Python 1.4) we did: fp = open('filename.txt') while 1: line = fp.readline() if not line: break print line …

python python-3.x python-2.7
What is the correct syntax for 'else if'?

I'm a new Python programmer who is making the leap from 2.6.4 to 3.1.1. Everything has gone fine until I tried to …

python python-3.x