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
-3 votes
0 answers
18 views

how can I compute the striking force of a football player using python [closed]

in a football match between England and Spain Julius Fueke needs a decisive goal, write a Python program that can compute the striking force of each of the players i tried using the import numpy but ...
54 votes
3 answers
59k views

Type hinting in Python 2

In PEP 484, type hinting was added to Python 3 with the inclusion of the typing module. Is there any way to do this in Python 2? All I can think of is having a decorator to add to methods to check ...
16 votes
1 answer
39k views

How to create a modal window in pyqt?

I looked into the documentation and I found self.setWindowModality(QtCore.Qt.WindowModal). I added this function to my __init__ function, but however still was not able to create a modal dialog box. ...
0 votes
1 answer
3k views

How to get a clean result when scraping a data from website using scrapy

I am new in python and I am trying to scrape a data from yellow pages. I was able to scrape it but I get a messed result. This was the result i got: 2013-03-24 20:26:47+0800 [scrapy] INFO: Scrapy 0....
1 vote
6 answers
14k views

Java client python server socket programming

I have a client program in java that sends a message "Hello" to python server. Java code import java.io.*; import java.net.*; public class MyClient { public static void main(...
0 votes
0 answers
60 views

can't find the libraries meta_lib and meta_log in pypi

I was trying to use a legacy script from a qualcomm flashing package (Packaged for QFIL) examining the script I found that it is: Python 2.7.18 (I'm have little or no experience with it. It makes ...
4 votes
3 answers
8k views

How do I check to see if a mouse click is within a circle in pygame?

import pygame pygame.init() white = 255,255,255 cyan = 0,255,255 gameDisplay = pygame.display.set_mode((800,600)) pygame.display.set_caption('Circle Click Test') stop = False while not stop: ...
0 votes
0 answers
16 views

how to make python 2.7 working in alma linux 9 with dnf

I have Alma Linux 9 in my VM, which is not compatible with python 2.7, but I need backward compatibility as well. I had installed python2.7 from the source code and created a softlink between /usr/bin/...
0 votes
3 answers
10k views

How to print only first few lines of output through python code?

Is there a special method/function to print only first few lines of output in python 2.7. We know that in terminal we could do that through "$head -3 " for seeing first 3 lines. do I have to just ...
18 votes
4 answers
39k views

How to fit a 2D ellipse to given points

I would like to fit a 2D array by an elliptic function: (x / a)² + (y / b)² = 1 ----> (and so get the a and b) And then, be able to replot it on my graph. I found many examples on internet, but no ...
122 votes
16 answers
88k views

Converting Snake Case to Lower Camel Case (lowerCamelCase)

What would be a good way to convert from snake case (my_string) to lower camel case (myString) in Python 2.7? The obvious solution is to split by underscore, capitalize each word except the first one ...
0 votes
0 answers
73 views

Python : threading.Thread block

import pymysql from multiprocessing.pool import ThreadPool def process(item): host = str(item).strip() db = None try: db = pymysql.connect(host=host, user='root', passwd='root', ...
0 votes
1 answer
1k views

PyInstaller: IOError: [Errno 2] No such file or directory: with ciscoconfparse library

I created an .exe of my python code using pyinstaller and it was working fine. But after importing this specific package "from ciscoconfparse import CiscoConfParse ", pyinstaller is able to create the ...
0 votes
1 answer
17 views

How to avoid "UserWarning: Reading `.npy` or `.npz` file required additional header parsing..."

I'm creating .npz files in Python 2 (yes, Python 2, not 3 and I can't change it) full of .npy files. When reading those .npz files, I'm having the warning message: "UserWarning: Reading .npy or ....
0 votes
2 answers
191 views

How do I count the number of common elements in two lists (including duplicates IF in both lists)?

I want to count the number of common elements in two lists, where duplicates are treated separately (i.e. if 'a' is in one list once and the other list twice, it is only counted once, but if it is in ...

15 30 50 per page
1
2 3 4 5
6345