Tagged Questions
Python is a dynamically and strongly typed programming language whose design philosophy emphasizes code readability. Two significantly different versions of Python (2 and 3) are in use. Please mention the version that you are using when asking a question about Python.
-2
votes
0answers
9 views
How to make download files app in django
I have 1000s of pdf files and i want o serve them via django not apache.
I want following things
Keep tract of which file has been downloaded how many times
I also want to serve each file by ...
0
votes
0answers
2 views
Title rows and columns of matplotlib subplot layout (replacing subplots with titles)
Suppose I have a 3x3 array of 9 subplots of identical sizes. Is it possible to make a 4x4 figure and replace the top and left-most subplots with large titles?
I know it's theoretically possible to ...
0
votes
0answers
6 views
Pandas: Duplicated groupby response
I found a very strange behaviour with the current Panadas' groupby method. Let's take the following DataFrame:
df = pd.DataFrame({
'Branch' : 'A A A A A B'.split(),
'Buyer': 'Carl Mark Carl Joe Joe ...
0
votes
3answers
22 views
Using a timer in a while true loop in Python
I have a problem in managing a infinite while loop in Python, in which I would insert a timer as a sort of "watchdog". I try to explain better: the script has to listen on a serial channel and wait ...
0
votes
0answers
20 views
Developing Python modules - adding them to the Path
I am pretty new to Python so it might sound obvious but I haven't found this everywhere else
Say I have a application (module) in the directoy A/ then I start developing an application/module in ...
0
votes
0answers
4 views
Python: xpath.find() won't find new elements if they were added without namespace
Today I stumbled upon a peculiar behaviour of the xml.dom and xpath modules and it took me a while to figure out it had to do with XML namespaces:
from xml.dom import minidom
import xpath
zooXml = ...
1
vote
1answer
14 views
Best way to interact with a service for exploitation purpose
Suppose I have a service to interact with. Using netcat it would be something like this:
> nc 127.0.0.1 8080
hello
hi how are you?
I want to automatize the interaction with this service in order ...
0
votes
0answers
7 views
Click on random link in webpage using selenium API for python
How can I click on random link on a given webpage using selenium API for python. ?
I'm using python 2.7.
Thanks
0
votes
4answers
26 views
Remove newline/empty characters in Python string
Well, this may sound repeat, but I've tried all possibilities like str.strip(), str.rstrip(), str.splitline(),
also if-else check like:
if str is not '' or str is not '\n':
print str
But I ...
1
vote
0answers
11 views
Python:Running multiple session at a time without closing the other sessions
i need a help for solving this issue, i'm running a python script for checking UDP data transfer between two pcs using IPERF.Problem is, after first telnet and configuration it closes the server ...
0
votes
1answer
27 views
Wrapping text during print Python
I am printing a few variables in a row. One of the variables is a very long string that I want to wrap the text (currently it's printing half a word at the end of a line if it has to) so I would like ...
0
votes
0answers
30 views
Error while using the id of one record in another record
models.py
from django.db import models
import datetime
class Categories(models.Model):
category_name=models.CharField(max_length=200)
def __unicode__(self):
return ...
0
votes
2answers
25 views
Given a set of locations and a single location, find the closest location from the set to the single
Given a set of locations and a single location, find the location from the set which is closest to the single location. It is not about finding a path trough nodes; it's about distance in a birds eye ...
0
votes
1answer
11 views
Depth First Search labeling (Python)
I need to label a tree's nodes by the order in which the nodes are visited during a depth first search. I have to implement it in Python. I'm trying to use networkx lib but still have no idea about ...
0
votes
0answers
36 views
python logging don't catch exceptions
When I try and use python's logging module, it seems to catch exceptions and print out an error instead of allowing the program to crash normally.
To initialize the logging I have this:
...