Top "Python-2.7" questions

Python 2.7 is the last major version in the 2.x series, and is no longer maintained since January 1st 2020.

How to completely uninstall python 2.7.13 on Ubuntu 16.04

I installed Python 2.7.13 on Ubuntu 16.04 according to this guide, and it became the default version as an alternative to the …

python python-2.7 ubuntu ubuntu-16.04
install beautiful soup using pip

I am trying to install BeautifulSoup using pip in Python 2.7. I keep getting an error message, and can't understand why. …

python python-2.7 beautifulsoup pip
Local variable referenced before assignment in Python?

I am using the PyQt library to take a screenshot of a webpage, then reading through a CSV file of …

python python-2.7 python-3.x variable-assignment
AttributeError("'str' object has no attribute 'read'")

In Python I'm getting an error: Exception: (<type 'exceptions.AttributeError'>, AttributeError("'str' object has no attribute 'read'",), <…

python python-2.7 urllib2 attributeerror
Getting attributes of a class

I want to get the attributes of a class, say: class MyClass(): a = "12" b = "34" def myfunc(self): return self.a …

python python-2.7 class attributes
How to print a string at a fixed width?

I have this code (printing the occurrence of the all permutations in a string) def splitter(str): for i in …

python python-3.x python-2.7 format
Python if-else short-hand

Possible Duplicate: Ternary conditional operator in Python I want to do the following in python: while( i < someW &&…

python python-2.7
Split a python list into other "sublists" i.e smaller lists

I have a python list which runs into 1000's. Something like: data=["I","am","a","python","programmer".....] where, len(data)= …

python python-2.7
RuntimeWarning: invalid value encountered in divide

I have to make a program using Euler's method for the "ball in a spring" model from pylab import* from …

python python-2.7 matplotlib
Relative imports for the billionth time

I've been here: http://www.python.org/dev/peps/pep-0328/ http://docs.python.org/2/tutorial/modules.html#packages Python packages: …

python python-2.7 import python-2.x relative-path