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.

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

0
votes
0answers
3 views

Switch media while streaming with libVLC.

streamer.py import vlc # libVLC import time class Streamer(): def __init__(self): self.Instance = vlc.Instance() sout = ...
0
votes
1answer
21 views

Python can't open myscript.py

I am trying to run my python program from cmd, but I have run into a problem. When I type myscript.py it gives my the error message: python: can't open file mysript.py:[Errno 2] No such file or ...
0
votes
0answers
6 views

Sqlite and python timestamp

I have this code in python 2.4: import datetime, time, sqlite def metodo(date): conn = sqlite.connect('dataBase.db') c = conn.cursor() c.execute("INSERT INTO f values(?,?)", ...
2
votes
0answers
21 views

Why does iterative elementwise array multiplication slow down in numpy?

The code below reproduces the problem I have encountered in the algorithm I'm currently implementing: import numpy.random as rand import time x = rand.normal(size=(300,50000)) y = ...
0
votes
1answer
27 views

Checking if function was called with right arguments

Which coding-style is better / correct and why? Using assert statement in each function: def fun_bottom(arg): assert isinstance(arg, int) #blah blah def fun_middle(arg): assert ...
0
votes
1answer
16 views

Using PHP to call python script

I have the following PHP code that I want to use to call a python script (ring.py) <?php echo '<p>Hello World</p>'; $output = exec('python ring.py'); ?> The program ...
3
votes
1answer
22 views

Python OrderedDict iteration

Why does my python OrderedDict get initialized 'out of order'? The solution here is less intriguing than the explanation. There's something here I just don't get, and perhaps an expanation would ...
-3
votes
3answers
37 views

Reverse game python

Hello i know this is asked a couple of times already but i couldnt find the answer. The question is about the reverse guess my number game. The code executes the program but not in a "humanlike" way. ...
0
votes
0answers
18 views

Use of tildes and ñ python SVN

Good afternoon, I have a script that searches for some documents in a repository without using a client, but when it returns the URLS (i need that), prints the "ó" like this m?\195?\179viles, i put # ...
2
votes
6answers
49 views

Removing duplicates in python list

I have the following list of titles: titles = ['Saw (US)', 'Saw (AU)', 'Dear Sally (SE)'] How would I get the following: titles = ['Saw (US)', 'Dear Sally (SE)'] Basically, I need to remove the ...
0
votes
4answers
38 views

Python list reduction

I'm working on a continuously learning focused web crawler to find news articles related to specific crisis and tragedy events that happen around the world. I am currently working on making the data ...
0
votes
1answer
12 views

Python code in GDB init file .gdbinit

I'm trying to create a ~/.gdbinit that contains some Qt pretty printers for various Qt objects, especially QStrings. I want to do this without Qt Creator, using regular GDB. This is what I've ...
0
votes
1answer
16 views

Fast RC4 cipher stream for Python?

I'm trying to write an app that needs large numbers of cryptographic strength pseudorandom bytes. The RC4 cipher would be ideal for this; it's lightweight and simple to understand conceptually. So, ...
0
votes
0answers
5 views

Gensim ImportError in PyCharm: No module named scipy.sparse

I am on Mac OS X 10.8.3 (Mountain Lion) and am trying to run a script in PyCharm. Python 2.7.2 is installed, I have installed Canopy and Gensim. I just do not understand what could be causing the ...
0
votes
1answer
19 views

Combining CUDA with Python's ODEInt and Parallel Reduction

I'm a graduate student in biophysics, trying to program a protein aggregation model using PyCUDA and Scipy's ODEInt. Within the past two weeks, I've gotten the code running, but it's very slow. Let ...

1 2 3 4 5 12518
15 30 50 per page