Skip to main content

Questions tagged [python-2.7]

Python 2.7 is the last major version in the 2.x series, and is no longer maintained since January 1st 2020. Use the generic [python] tag on all Python questions. Do not add this tag simply to convey the version of Python you're using, unless the question concerns an issue specific to Python 2.7.

python-2.7
259 votes
10 answers
1.1m views

How can I read inputs as numbers?

Why are x and y strings instead of ints in the below code? (Note: in Python 2.x use raw_input(). In Python 3.x use input(). raw_input() was renamed to input() in Python 3.x) play = True while play: ...
user avatar
8 votes
3 answers
7k views

How to click on a element through Selenium Python

I'm trying to fetch data for facebook account using selenium browser python but can't able to find the which element I can look out for clicking on an export button. See attached screenshot I tried ...
DKM's user avatar
  • 1,791
272 votes
15 answers
929k views

input() error - NameError: name '...' is not defined

I am getting an error when I try to run this simple script: input_variable = input("Enter your name: ") print("your name is" + input_variable) Let's say I type in "dude",...
chillpenguin's user avatar
  • 3,039
473 votes
48 answers
1.3m views

urllib and "SSL: CERTIFICATE_VERIFY_FAILED" Error

I am getting the following error: Exception in thread Thread-3: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line ...
user3724476's user avatar
  • 5,070
208 votes
17 answers
987k views

How to detect key presses?

I am making a stopwatch type program in Python and I would like to know how to detect if a key is pressed (such as p for pause and s for stop), and I would not like it to be something like raw_input, ...
lobuo's user avatar
  • 2,315
514 votes
6 answers
592k views

How to sort a pandas dataFrame by two or more columns?

Suppose I have a dataframe with columns a, b and c. I want to sort the dataframe by column b in ascending order, and by column c in descending order. How do I do this?
Rakesh Adhikesavan's user avatar
169 votes
17 answers
362k views

How to write to an existing excel file without overwriting data (using pandas)?

I use pandas to write to excel file in the following fashion: import pandas writer = pandas.ExcelWriter('Masterfile.xlsx') data_filtered.to_excel(writer, "Main", cols=['Diff1', 'Diff2']) writer....
BP_'s user avatar
  • 2,597
452 votes
17 answers
1.1m views

How to uninstall Python 2.7 on a Mac OS X 10.6.4?

I want to completely remove Python 2.7 from my Mac OS X 10.6.4. I managed to remove the entry from the PATH variable by reverting my .bash_profile. But I also want to remove all directories, files, ...
Jan Deinhard's user avatar
177 votes
17 answers
177k views

Not able to install Python packages [SSL: TLSV1_ALERT_PROTOCOL_VERSION]

I am trying to install a Python library using pip, getting an SSL error: ~/projects/base  pre-master± pip install xdict Collecting xdict Could not fetch URL https://pypi.python.org/simple/xdict/:...
Nishant Nawarkhede's user avatar
213 votes
13 answers
325k views

How to save and load cookies using Python + Selenium WebDriver

How can I save all cookies in Python's Selenium WebDriver to a .txt file, and then load them later? The documentation doesn't say much of anything about the getCookies function.
Aaron Hiniker's user avatar
193 votes
9 answers
576k views

Zip lists in Python

I am trying to learn how to "zip" lists. To this end, I have a program, where at a particular point, I do the following: x1, x2, x3 = stuff.calculations(withdataa) This gives me three lists, x1, x2, ...
AJW's user avatar
  • 5,805
151 votes
22 answers
627k views

Adding Python to PATH on Windows

I've been trying to add the Python path to the command line on Windows, yet no matter the method I try, nothing seems to work. I've used the set command, I've tried adding it through the Edit ...
rogerklutz's user avatar
  • 1,511
519 votes
20 answers
1.3m views

How to fix: "UnicodeDecodeError: 'ascii' codec can't decode byte"

as3:~/ngokevin-site# nano content/blog/20140114_test-chinese.mkd as3:~/ngokevin-site# wok Traceback (most recent call last): File "/usr/local/bin/wok", line 4, in Engine() File "...
fisherman's user avatar
  • 10.8k
18 votes
4 answers
3k views

Regular expressions: Ensuring b doesn't come between a and c

Here's something I'm trying to do with regular expressions, and I can't figure out how. I have a big file, and strings abc, 123 and xyz that appear multiple times throughout the file. I want a ...
Ram Rachum's user avatar
  • 87.1k
44 votes
4 answers
54k views

IPython Notebook locale error [duplicate]

After installing the latest Mac OSX 64-bit Anaconda Python distribution, I keep getting a ValueError when trying to start the IPython Notebook. Starting ipython works fine: 3-millerc-~:ipython ...
Clayton's user avatar
  • 1,545

15 30 50 per page
1
2 3 4 5
659