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

Python Twisted Multithreaded Clients

Would this be the appropriate way to create multiple clients on a single machine? def main(): threads = [None]*10 for i in range(0, 10): threads[i] = ClientFactory() ...
0
votes
0answers
7 views

How can i make a list of directories from two list nested (parent and child)

I have a parent-list of two element( P= ["E:\GIS_DOCUMENT\BCAS_Map\BCAS_All.gdb\BD_Admin" , "E:\GIS_DOCUMENT\BCAS_Map\BCAS_All.gdb\BCAS_BD_Infrastructure"]) but first element has another list Cld1 = ...
0
votes
1answer
12 views

Fetching number via python

I am communicating to serial ports via python. I passed an AT command to list the phone directory. Now I need to fetch the phone number I received. How do I fetch that particular number via python. ...
0
votes
1answer
13 views

unable to delete a file using os.remove()

In the end, the script is unable to delete a file throwing an error message like "The process cannot access the file because it is being used by another process: ...
0
votes
0answers
9 views

How to make progressbar works in python?

Imagine I want to make a simple program with GUI like this. this is my code: from gi.repository import Gtk import gobject class gui(): def __init__(self): self.window = Gtk.Window() ...
4
votes
4answers
40 views

Remove a prefix from a string

I am trying to do the following, in a clear pythonic way: def remove_prefix(str, prefix): return str.lstrip(prefix) print remove_prefix('template.extensions', 'template.') This gives: ...
0
votes
0answers
8 views

How to plot line as surface with matplotlib

I have a few data lines, let's say: DATA = dict() DATA[2] = ( [-4, -2, 0, 2, 4, 6, 8, 10], # X [2.6390e-01, 2.1350e-01, 1.5854e-01, 1.0401e-01, 5.6534e-02, 2.2940e-02, 5.9655e-03, 7.8050e-04] # Y ) ...
2
votes
1answer
15 views

django python conditional not working?

I have this code in django and when I print it in the console it outputs user_id = 1 and request.user.id = 1 so the url is http://127.0.0.1:8000/upload/picturelist/1, which makes user_id = 1, then I ...
1
vote
1answer
19 views

I can't get mock to work

I'm trying to use a mock for unit testing with Python/Django but I just can't get it to work. The mock acts like it has never been called. tests.py from my_module import my_library my_library = ...
0
votes
1answer
10 views

Python delete xml tags and move xml tags

I am new to python and have been trying to accomplish something, and not been sucsessful so far. I am trying to open an xml, delete whole tags and their contents, and move other tags around within the ...
0
votes
0answers
17 views

magic function %autoreload not found in ipython?

How can I achieve %autoreload's functionality if it is missing from my ipython 0.12.1? (Some say that many magic funtctions are removed from newer versions and I think there must be some new way of ...
0
votes
2answers
22 views

how can i make a delay of 5 sec while redirecting one page to another in django views

I used this code but the delay I want is not accomplished . I want it to stay there for atleat 5 sec from django.http import HttpResponseRedirect def myview(request) : ... return ...
0
votes
0answers
17 views

python html text send mail has messy code

good friends when send html text email as that: ... htmltext="""<table><tr><td bgcolor="#fe45se"> one</td><td bgcolor="#dddddd">two</td> ...
0
votes
4answers
41 views

python: output of os.system is not considered for a true/false check?

So I've got this to find out if a process is running or not: os.system("ps aux | grep [my]process") I use the square brackets so I don't get back the grep command too. Altho when I try to do ...
1
vote
3answers
25 views

Normalise and Perpendicular Function in python

I was going through a blog on Creating Lightning effect in 2D game.I wanted to implement the same in python. However I am stuck at a place. Lets say startpoint and endPoint are co-ordinates in 2D ...

1 2 3 4 5 12840
15 30 50 per page