2 answers

Efficient memory usage in python

I wrote a Python script using pyodbc to transfer data from an excel sheet into ms access and also using matplotlib to use some of the data in the excel sheet to create plots and save them to a folder. …

3 answers

how to get certain words from user input

Hello i am trying to make my program check for certain words in the user input. For example: The user types "add the numbers 6+6" what the programs does is it has a dictionary and checks the words in …

33 secs ago
2 answers

ModelForms in Django with Bootstrap

I can see that you can use django-bootstrap-toolkit to generate bootstrap forms in Django. This looks pretty cool. However I have 2 questions, Can django-bootstrap-toolkit be used also for ...

8 mins ago
1 answer

What is {!text!} in Python?

What do {!info!} and {!input!} do in this python code? s += " {!info!}Down Speed: {!input!}%s" % common.fspeed(status["download_payload_rate"]) Taken from: ...

14 mins ago
1 answer

Time at which tuple was generated in Django

Is there a way to get the time at which a tuple was added in a table? Or more specifically, the tuples that have a timestamp in between say a given range?

14 mins ago
1 answer

Calculating time difference of each occurance of a IP

I have a Apache log file in the following format: 112.135.128.20 - [13/May/2013:23:55:04 +0530] "GET /SVRClientWeb/ActionController HTTP/1.1" 302 2 "https://www.example.com/sample" "Mozilla/5.0 ...

15 mins ago
2 answers

callback Python from Fortran

Now I am using the f2py to call Python function from Fortran code. I have tried a very easy example but it didn't work. Fortran90 code: subroutine foo(fun,r) external fun integer ( kind = 4 ) i real …

2 answers

Python (Matplotlib) - show multiple figures (plots) with an x and/or y offset (so without overlapping)

I'm trying to show multiple figures at once, but with an offset so I don't have to move the first figure to check that it showed all the figures (plots). So here's an example: from pylab import * …

0 answers

PyQT application: why listeners doesnt work on Windows?

I create a PyQT application with QtCreator. It works well on linux without any problems, but when I try to test it on an windows 7 the main dialog appears, but none of the slots or listeners work and …

29 mins ago
1 answer

Python-ldap ldap.initialize rejects a URL that ldapurl considers valid

I want to open a connection to a ldap directory using ldap url that will be given at run time. For example : ldap://192.168.2.151/dc=directory,dc=example,dc=com It is valid as far as I can tell. …

31 mins ago
1 answer

How to display a query set in the django admin?

I wish to over ride the django admin to display a list of recently added events in the admin page. I read about queryset in the docs but it is probably for returning a queryset that can be changed by …

31 mins ago
2 answers

Crazyflie USB3 incompability

I've been tinkering with crazyflie lately but it seems the firmware doesnt detect USB3.0 properly, there's a way around it but when i tried to follow the instruction, even the dongle is not detected. …

32 mins ago
0 answers

Python - convert byte array to string

I wrote a 17-byte array onto a binary file through C# as follows: protected BinaryWriter Bw; protected long something; ... ... byte[] myStringByteArray = new byte[17]; ...

35 mins ago
1 answer

Python - using decorator.py to preserve a method docstring

I am interested in calling an instance method as both a class method as well as an instance method. This can be done by using the class_or_instance decorator as follows: class ...

1 answer

Why does this code not work? Python RE (regular expression)

I am trying to use RE with python to extract all the products off of a random page. However, I do not know why I am not getting any matches. I am positive that the problem is occurring with the ...

43 mins ago
1 answer

Trouble retrieving JSON from python script via $.getJSON in javascript

Right now, I'm trying to access data from the education.com API. However, I'm still unable to do so. Basically, from what I understand, I'm supposed to use this python script to suppress the cross …

1 answer

How to split text in Python 3

My assignment is to open a file and to open a text file and make a list of the all the words used. I am able to open, read, and close the file, however, when I try to split, I get the following error …

59 mins ago
2 answers

Calculating computational time and memory for a code in python

Can some body help me as how to find how much time and how much memory does it take for a code in python?

1 hour ago
0 answers

python - Getting Pip to use MinGW32 on Windows?

This has been asked and answered a few times, but as you'll see none of the previous answers work for me -- I feel like something had changed to make all the old answers outdated. Or at the very ...

1 hour ago
2 answers

Python Print String To Text File

I'm using Python v2. At the moment I have this code to open a text document: ext_file = open("Output.txt", "w") text_file.write("Purchase Amount: " 'TotalAmount') text_file.close() What I am ...

1 hour ago
1 answer

horizontal tree with graphviz_layout

in python, with networkx. I can plot a vertical tree with : g=nx.balanced_tree(2,4) pos = nx.graphviz_layout(g, prog='dot') nx.draw(g,pos,labels=b_all, node_size=500) plt.show() ...

1 answer

Can copy_to query by using binding arguments?

>>> cur.copy_to(sys.stdout, 'test', sep="|") 1|100|abc'def 2|\N|dada ... I review the document of psycopg2 , I want to use copy_to function to select large data, But I could not find the way using …

2 answers

Python pandas order column according to the values in a row

How do I order columns according to the values of the last row? In the example below, my final df will have columns in the following order: 'ddd' 'aaa' 'ppp' 'fff'. >>> df = ...

1 hour ago
1 answer

Root mean square error in python

I know I could implement a root mean squared error function like this: def rmse(predictions, targets): return np.sqrt(((predictions - targets) ** 2).mean()) What I'm looking for if this rmse …

1 hour ago
0 answers

Python Setup Script Errors on Mac OS X

I'm working through some issues installing some Python code based on Pylons on my Mac running OS X 10.8. There seems to be some problem with the code in setup.py that results in a weird compilation …

1 hour ago
0 answers

Returning result of an external script to VBA

SOLVED! See last half of post for solution. I am working on porting a macro that we have working in MS Word for Windows to OSX. The macro allows the user to generate equations using LaTeX in Word, …

1 hour ago
2 answers

Can you search backwards from an offset using a Python regular expression?

Given a string, and a character offset within that string, can I search backwards using a Python regular expression? The actual problem I'm trying to solve is to get a matching phrase at a particular …

1 hour ago
3 answers

python ftplib specify port

I would like to specify the port with python's ftplib client (instead of default port 21). Here is the code: from ftplib import FTP ftp = FTP('localhost') # connect to host, default port Is there …

1 hour ago
1 answer

Hangman never finishes

FIXED This is a Hangman game in Python I've tried to find the solution of this, but it doesn't work. All is good, but when you get all the words, it doesn't tells you that you won, it stills asking …

1 hour ago
2 answers

What tools are available to visualize in-class dependencies (e.g. for PHP)?

I am looking for an easy-to-use tool which can visualize the 'inner working' of a class, written e.g. in PHP. What I would like to see are the different class methods, and how they are related (method …

1 hour ago
15 30 50 per page
1 2 3