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
10 views
Problematic function pickling
In one module, I have a class which requires a function as one of its parameters:
class Foo():
def __init__(self, fun):
self.fun = fun
def call_fun(self, arg):
self.fun(arg)
...
0
votes
0answers
6 views
find tags except those with attributes: BeautifulSoup
In this page that I'm trying to scrape, i want to exclude those <td> that has attributes.
<td > Click here for a comprehensive area code list for Argentina </td>
I'd like to know ...
1
vote
2answers
21 views
Write key to separate csv based on value in dictionary
[Using Python3] I have a csv file that has two columns (an email address and a country code; script is made to actually make it two columns if not the case in the original file - kind of) that I want ...
1
vote
1answer
15 views
Grouping python pandas
Could you tell me how to group a table (from products1.txt file) like following:
Age;Name;Country
10;Valentyn;Ukraine
12;Igor;Russia
12;Valentyn;
10;Valentyn;Russia
So I can find out how many ...
1
vote
1answer
26 views
Function accepts keyword arguments that are not identifiers
In Python, is it safe to give keyword arguments that are not Python identifiers to a function? Here is an example:
>>> '{x-y}'.format(**{'x-y': 3}) # The keyword argument is *not* a valid ...
0
votes
0answers
14 views
How to get id from DELETE request made from PHP in Flask Python
I make a CURL DELETE request from PHP like this:
$data = array("id" => "id_here");
$data = array('entry' => json_encode($data));
$ch = curl_init("url_here");
curl_setopt($ch, ...
2
votes
1answer
18 views
python modules: share variables and enable running files
sorry for this newbie question.
I've got a client.py and server.py scripts, which I want to use to write a simple socket game. I would like to build a python package out of it. I would like the ...
0
votes
0answers
5 views
twisted , return custom message to client after receiving request from client
I have Written a simple code of http server and http client, i am able to successfully send messages to server in form of xml from client. here's my code.
client.py
from StringIO import StringIO
...
0
votes
0answers
8 views
Transparency for RstDocument in Kivy
Is there any chance to make RstDocument transparent in Kivy?
There is a dict property colors, which can be used for setting colors:
class TipRstDocument(RstDocument):
colors = DictProperty({
...
3
votes
0answers
21 views
Detect device names on serial ports in Python
I use a USB connected Nokia phone to send SMS messages via a COM port in Windows using Python. Evertyhing works fine until a COM port changes. Is there a way to detect which COM port my phone is ...
0
votes
0answers
13 views
Store a python collections.Counter as PickleProperty in App Engine
I am able to store a collections.Counter into the app engine data store, however when I retrieve it and try to parse it, I get the following error:
for word in counter:
TypeError: 'NoneType' object ...
1
vote
0answers
6 views
Texturing on 3d Blocks using pycollada
I am developing a python script which will be able to generate .DAE (COLLADA) files along with the associated KML files for developing 3D models of buildings. I have the street images of the ...
0
votes
1answer
30 views
Why does this function not re-prompt the user after an incorrect guess?
I have been writing a piece of code in my free time, messing around with opening/closing files to try and get a 100% secure file.
I have this so far:
def StartLock():
my_pass = open("pass.txt", ...
0
votes
0answers
19 views
Big amount of files is created when using popen
i am using popen to run a command in my python script:
p = Popen(DPI_CLI_LOCATION, shell=True , bufsize=0, stdout=PIPE,stdin=PIPE)
p.stdin.write(self.data)
print ...
0
votes
1answer
12 views
How to add an instance attribute to a subclass of webapp2.RequestHandler?
I have the following class definition:
class TestHandler(webapp2.RequestHandler):
def get(self):
self.msg = "hello world"
self.render_form() # modifies self.msg
def ...