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.
0
votes
0answers
8 views
Filter out values from python mysql query
I am using mysql.connector in python to get a list of values from a database.
can you please help extract each value from the list separately
my code is as below
cnx = ...
0
votes
0answers
2 views
Using twisted to serve gzipped JavaScript
I tried to use EncodingResourceWrappper and GzipEncoderFactory to gzip my twisted web server responses.
This seems to work for most files. But I can not serve JavaScript files which are later loaded ...
0
votes
3answers
15 views
How to check for a necessary input of raw_input?
I've started to learn python only a day ago, seems to be easy, but still have some questions :)
how to write a script which have to check necessary input of raw_input?
I mean, the script must stop ...
0
votes
1answer
25 views
How combine two dictionaries? One dict as key, another dict as value
I have two dictionaries
Dict0 = {'a':0, 'b':1, 'c':2}
Dict1 = {0 : {'a0' : 0,'a1' : 1,'a2' : 2},
1 : {'b0' : 0,'b1' : 1,'b2' : 2},
2 : {'c0' : 0,'c1' : 1,'c2' : 2}}
I would like ...
0
votes
1answer
9 views
numpy.searchsorted in a multidimensional array
I have got a three dimensional array with air pressure values in the form:
[[[1000 1010]
[1005 990]]
[[950 960]
[955 940]]
[[900 910]
[905 890]]]
The structure represents the pressure at ...
0
votes
1answer
28 views
Getting TypeError: expected string or buffer in python
I have this simple code:
#usr/bin/python
from bs4 import BeautifulSoup
import requests
import tldextract
def scrap(url):
main_domain = tldextract.extract(url)
r = requests.get(url)
data ...
0
votes
0answers
9 views
zoneinfo data corrupt, how do I compile new data?
Basically the same thing happened again as when I asked this question. However this time I cannot get it right again. I tried the answer of Burhan Khalid again and I get the same errors again. I also ...
1
vote
1answer
17 views
Python logging module is printing lines multiple times
I have the following code:
import logging
class A(object):
def __init__(self):
self._l = self._get_logger()
def _get_logger(self):
loglevel = logging.INFO
l = ...
0
votes
0answers
18 views
Jquery button click to send AJAX request with Flask and Python
I am trying to make a web application that accepts button clicks. The button clicked then sends a specific device, and operation code to the python application which then calls a irsend command using ...
0
votes
5answers
68 views
Python (loops) with a list
I am learning Python, and struggling with conditions of a for loop. I must be missing something simple. I have a list with some int values, and I want to (1) print all even numbers and (2) only print ...
-3
votes
5answers
59 views
Call attribute method python
I want to display hour when i call date.now.hour but I get this error
AttributeError: 'function' object has no attribute 'hour'
this is my code:
#!/usr/bin/python
class Date:
def now(self):
...
0
votes
0answers
13 views
hierarchical clustering python with scipy how to get the right k?
at the moment I'm clustering my data with scipy by using k-means like that.
centeroids,dist = kmeans(desc,k)
and for the k i'm trying out some values to get a good clustering. I have read that with ...
0
votes
1answer
18 views
Check argument passed via python cmd module
This is a two parts question, please see below:
I need to create some sort of console to be used by testers to run some commands manually! Is the cmd module a good way to go?
Below Is the code I ...
-8
votes
0answers
35 views
Website and data protection security solution [on hold]
What kind of Data Protection tools these websites are using?
http://www.insightsquared.com/features/
http://www.freshbooks.com/
-1
votes
0answers
21 views
Get FORM id in python - Django views.py
The question is self-explanatory.
<form action ="#" method = "POST" id = 1 name = "reply_form" >
<input type = "hidden" value = "reply_form" >
<input type = "submit" value = ...