Python is a dynamic and strongly typed programming language that is designed to emphasize usability. Two similar but incompatible versions of Python are in widespread use (2 and 3). Please consider mentioning the version and implementation that you are using when asking a question about Python.

learn more… | top users | synonyms (3) | python jobs

0
votes
0answers
4 views

Crypt module (windows) how change it?

I have a problem with this script: Script It works only on Linux. Can anybody change it for my? I need to use that script on Windows... I completly doesn't know Python :( I tried fcrypt (I put it on ...
-2
votes
1answer
11 views

Renaming multiple files in a folder using python

Python script. import os [os.rename(f, f.replace('', 'xyz_')) for f in os.listdir('.') if not f.startswith('.')] from above script i want to rename the files as Before 1.0.1.0.html 1.20.0.0.html ...
0
votes
0answers
5 views

Facing issue while listing file contents in cygwin

Context: I want to install ".msi" file on remote windows machine via python script. I have installed cygwin on remote windows machine and ssh service is running. I execute the command via ssh on ...
0
votes
0answers
4 views

how to install packages from pypi to anaconda?

I've been using Anaconda in Window for all my python coding. I've got a few questions: How do I check all the existing packages/modules I've installed? What commands do I need to type? How do I ...
0
votes
0answers
16 views

Print/write date to a file only if it's a different day. (Python)

I'm doing a maths quiz that asks people questions and at the end it would write their name and score to a file. I want there to be a date before the scores but the way I do it: ...
0
votes
0answers
5 views

Recover the data already recorded in my Django admin space in my form

I want to know how to retrieve answers already made in my text fields because there is no ways to retrieve the answers already registered! This is my models : class Patient(models.Model): ...
1
vote
0answers
18 views

Having trouble using reverse()

It feels like this is a simple problem but I am obviously missing something. url = reverse('specific', args=(var.pk,)) print(url) The error message i get is: Reverse for 'specific' with arguments ...
0
votes
0answers
5 views

Set-like alternative for yaml files

I'm using a YAML file to store some data to be used by my Python script. The structure is more or less as follows: <id1>: email: <email address for id 1> phone: <phone number ...
0
votes
0answers
7 views

using web.py behind a proxy

I'm using web.py to create HTTP listener server. when I try to connect to the server I get "connection refused" due to proxy installed on my browser. I can't remove the proxy. How can I set the proxy ...
0
votes
0answers
6 views

Direct chart plotting Pandas DataFrame columns to Xlsxwriter in a loop

I am looking for an efficient way to print multiple Pandas DataFrame plots directly to Excel using xlsxwriter without the need to save the plot to file each time. I have my DataFrame generated and I ...
-2
votes
0answers
29 views

Python 2 vs Python 3: 2015 usage

Is Python 2 still the 800 pound gorilla in the room? Is Python 2 being used more in 2015 despite Python 3's release back in late 2008? Is there any official data regarding language use of Python 2 or ...
0
votes
0answers
7 views

matplotlib figure closing order

I use matplotlib to plot multiple graphs, each in a separate figure window. When I close the figures, starting with the first figure window, my python script crashes upon closing the last figure ...
-1
votes
0answers
7 views

NAT hole punching, browser to python and back

does anyone have any idea how to use smth like WebRTC with python. We have a problem that both devices are behind NAT, one is a Raspberry Pi with python and the other one is browser. tnx for help
-2
votes
0answers
6 views

python pygame - how to create a drag and drop with multiple images?

So I've been trying to create a jigsaw puzzle using pygame in python.The only problem is that I'm having trouble creating the board with multiple images that i can drag along the screen (no need to ...
0
votes
0answers
5 views

SOAP client in python: obtaining a token from a Security Token Service

I'm trying to set up a SOAP client in python (using suds). The webservice is using WS-security, so I have to obtain a token from an STS, which can then be used to open the client. So far, I've tried ...
-4
votes
0answers
17 views

How to ideally implement tree object model from PTB text in JAVA? [on hold]

Hi I am implementing tree data structure (most probably in JAVA but Python is also allowed). Each of the tree nodes will store a word(string) and a score(int) and will have pointers to its parent,left ...
-2
votes
1answer
35 views

Python count 2 variable if unique

The code has to count the 2 variable if they are unique. But i cant get it to work. Does someone have an idea how i can get it to work? I want the output to be: C603 100nF 8 Here is a litle ...
0
votes
2answers
8 views

Django Query to get customer_name who has used a particular keyword maximum no. of times in feedback?

I have these models: class Customer(models.Model): customer_name = models.CharField(max_length=100) def __unicode__(self): return self.customer_name class Feedback(models.Model): ...
0
votes
1answer
11 views

Detecting daily recurrency in pandas

I have a Pandas Data Frame like this from datetime import timedelta import pandas as pd df = pd.DataFrame({'Team':pd.np.random.choice(['CHI', 'DAL'], 10), ...
1
vote
1answer
31 views

Dictionary value is another dictionary

Consider this dict1={} dict2={} dict2["first_d2"]="Yes" dict1["first_d1"]=dict2 print dict1 print dict2 dict2={} print dict1 ===>Here's the doubt print dict2 The Output: {'first_d1': ...
0
votes
1answer
22 views

replace hours in a datetime type python

I have a datetime type mydate in %Y-%m-%dT%H:%M:%S format. I want to replace the hours I did this using mydate.replace() method Now I want to comapre it with another specific date -> myNEWdate whose ...
0
votes
1answer
8 views

Accessing and editing pandas.DataFrame via index/column entry

i want to access a pandas DataFrame elementwise by giving the row and the column; seems simple to me, but researching didn't give the answer. I got this far: import pandas as pd import numpy as np ...
1
vote
2answers
23 views

How to find maximum number from csv-read data in Python 2.7?

There is a CSV called vic_visitors.csv with this data: Victoria's Regions,2004,2005,2006,2007 Gippsland,63354,47083,51517,54872 Goldfields,42625,36358,30358,36486 Grampians,64092,41773,29102,38058 ...
0
votes
1answer
15 views

Numerical Differenciation as Matrix-Vector Product

I have the following code to approximate the second derivative of a function f() using the formula: I would like to compare two different approaches; With loops and with matrix-vector product and ...
0
votes
0answers
16 views

how to avoid flask insert duplicate entries?

I want to update my database using the code snipped provided below: import writedatabase as wdb @app.route('/update') def update(): for x in range(4): wdb.pushit(1,1,1) return ...
0
votes
1answer
11 views

Binary to CSV record Converstion

Hi FolksI have been working on a python module which will convert a binary string into a CSV record. A 3rd Party application does this usually, however I'm trying to build this logic into my code. The ...
1
vote
1answer
22 views

Python 3 UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d

I want to make search engine and I follow tutorial in some web. I want to test parse html from bs4 import BeautifulSoup def parse_html(filename): """Extract the Author, Title and Text from a ...
1
vote
2answers
20 views

How can I duplicate python 2 chr exactly in python 3

Hi I am trying to migrate some code to python 3 but am having the following problem. Python 2 >>> a = chr(217) >>> print a, type(a) � <type 'str'> Python 3 >>> a ...
0
votes
3answers
30 views

What is wrong with this code to make it miss removing the last html file from the list?

Using Python 2.7 on mint. trying to remove all HTML or XML files from a list of files from a directory. When the file name is all numbers, it will only remove 3 of the four non image files...and in ...
0
votes
0answers
11 views

Conflict between two flags in cmd of python command line

i have python process which fires several another sub processes. All of my sub processes by default runs with -flag false flag (this fact cannot be changes as otherwise it will harm sub processes ...
0
votes
0answers
8 views

I can't pivot a pandas dataframe

I know this should be really easy but I keep getting errors when trying to pivot. I'm getting my data from psycopg2 cur.execute("select * from table") arr=cur.fetchall() pdres=pandas.DataFrame(arr, ...
1
vote
0answers
28 views

NumPy vs MATLAB

I've started to use NumPy instead of MATLAB for a lot of things and for most things it appears to be much faster. I've just tried to replicate a code in Python and it is much slower though. I was ...
0
votes
0answers
21 views

Cached properties for classes

I like the cached_property module: https://pypi.python.org/pypi/cached-property Is there a way to get cached properties for classes? Here is an example for "properties for classes" class ...
1
vote
0answers
15 views

Django - possible leak of file descriptors?

I am developing application in Django where I want to use multiprocessing in order to perform effective computation but somehow python/Django keeps open file descriptors to local database what makes ...
0
votes
0answers
15 views

Deploying Java Web Application in Eclipse

I've created a Java application in Eclipse that displays an ArcGIS map and needs to execute Python and some other external software like PowerWorld on my computer. I have purchased a domain name and ...
-1
votes
6answers
44 views

How to change this for loop to while loop?

Having a bit of trouble with while loops. I understand this basic for loop runs through whatever is passed into the function but how would I change the for loop to a while loop? Thought it would be as ...
1
vote
0answers
17 views

Force method overriding

I have an abstract django model, that contains some methods, that have to be overriden by the child class. Is there a way to make sure (by throwing otherwise an exception) that the methods have been ...
0
votes
0answers
3 views

One setup and teardown function for all nosetests tests

How can I use a common setup and teardown function for all nosetests tests? def common_setup(): #time consuming code pass def common_teardown(): #tidy up pass def test_1(): pass ...
3
votes
1answer
19 views

Optimizing point - circle distance method

I'm implementing a RANSAC algorithm for circle detection in images. I profiled the execution and I get: 13699392 function calls in 799.981 seconds Random listing order was used ncalls ...
0
votes
2answers
20 views

How to iterate over x number of lists using zip [duplicate]

I have several lists which I need to iterate over. I've got the zip function working very nicely, but to make my code more flexible I was wondering how you would use zip, but get the number of lists ...
0
votes
0answers
13 views

psutil: username differs from ps

This is a snippet for psutil behavior I do not understand: the username psutil returns differs from what ps returns: $ ps -u condor PID TTY TIME CMD 1435 ? 00:00:12 condor_master ...
0
votes
0answers
14 views

how do I lock an elasticsearch document using python

I'm using the official elasticsearch python module. How do I lock a document to ensure that my partial update is safe in a multi-user system?
0
votes
3answers
20 views

Django 1.8.2 - display dictionary of dictionary in template

I am using Django 1.8.2 and I am having some trouble figuring out how to iterate over this complex dictionary. I am trying to pass this information onto my template and display the information. ...
-4
votes
3answers
27 views

Python: How to extract data in text file based on class information from another text file?

In this case there are 3 classes which is represented by the value 0, 1 and 2. I would like to extract information that are belong to class 1 from another text file called fileA.txt. I would like to ...
0
votes
0answers
16 views

Pandas plot dataframe as scatter complains of unknown item

I have thousands of data points for two values Tm1 and Tm2 for a series of text lables of type : Tm1 Tm2 ID A01 51 NaN A03 51 NaN A05 47 52 A07 47 52 A09 49 NaN I managed to create a ...
1
vote
3answers
19 views

Django 1.8 using multiple DetailView

I've been trying to use multiple DetailView's in my views.py but due to some reason I'm getting this error during template rendering. http://prntscr.com/7f8vql http://prntscr.com/7f8vlv . My ...
-1
votes
1answer
48 views

split() Error:list index out of range

line = "2013/12/10@19:48:25" datetime = line.split('@') print datetime[1] Whenever my program runs, it gets an error. I dont know why. but whenever i check the datetime variable it contains this ...
0
votes
1answer
9 views

Django: MTI get list of child classes

Is there a way to get all child classes of a django multi table inheritance? Example: class Parent(models.Model): pass class ChildOne(Parent): pass class ChildTwo(Parent): pass I ...
1
vote
1answer
14 views

Proper way to handle custom submit button at django custom model admin add page

I want to add an extra button at submit_line.html that does exactly the same thing as submit but it sets certain field to something else while sending post request to server. Say I have a blog as ...
-2
votes
0answers
11 views

Sparse Matrix in GPU (Python or Matlab)

Anyone knows libraries supporting Sparse Matrix in GPU using Python or Matlab. I know that for Python, Theano or Gnumpy can be used in GPU, but only supporting dense matrix. I failed to find out ...