Interesting Tags
   11 tags on

5 answers

BeautifulSoup Grab Visible Webpage Text

Basically, I want to use BeautifulSoup to grab strictly the visible text on a webpage... For instance, this webpage is my test case http://www.nytimes.com/2009/12/21/us/21storm.html .. And I mainly …

1 answer

Need help understanding a recursion example in Python

Python is my first programming language, and I'm learning it from "How to Think Like a Computer Scientist". In Chapter 5 the author gives the following example on recursion: def factorial(n): if n …

3 answers

Output the rows with certain initial string of some specific column

I have a tab-delimited txt file like this: A B aaaKP C D bbbZ E F cccLL This is tab-delimited. If phrase = aaa or bbb column = 3 then I would like only those rows whose 3rd column …

1 answer

Python beginner issues - dictionary

I've been trying to produce a program with an output: Enter line: which witch Enter line: is which Enter line: is 1 which 2 witch 1 How I want it to work is for you to enter a few lines, and when …

0 answers

How to recover from a MELD crash when re-install does not assist?

I did a directory tree copy from one drive to another with Caja drag-and-drop for safe keeping. I used Meld to compare to check the copy was good. It compared the directories okay and said they …

1 answer

Premature end of script headers Error in python cgi script

I am running to a problem a vps I recently moved to. I am trying to run a python cgi script, but I am getting an apache Premature end of script headers Error. (I chmod +x the script file) The script …

1 answers | 21 mins ago by MrCastro on Stack Overflow stackoverflow.com
1 answer

How to handle a vendor who asks for the solution of an issue they could not solve

Being a small department of developers, it's not uncommon for us to outsource projects. We have a set of companies that we really like to work with, very reliable and good local people who appreciate …

1 answer

How to set a timer & clear a timer in python?

I am new to python. Now, I want to create a timer. When it times out, some actions will be taken. But, I can interrupt this timer and reset it. The pseudo code looks like below: def timeout() ...

1 answers | 42 mins ago by city on Stack Overflow stackoverflow.com
2 answers

BeatifulSoup4 get_text still has javascript

I'm trying to remove all the html/javascript using bs4, however, it doesn't get rid of javascript. I still see it there with the text. How can I get around this? I tried using nltk which works fine …

2 answers | 46 mins ago by KVISH on Stack Overflow stackoverflow.com
0 answers

Key error in python, for loop works but can't call key directly?

I have code which loops through a dictionary like so: for key in dict: print "key value is:",key print "key type is:",type(key) print "dictionary value is:",dict[key] and this will provide me …

6 answers

Python : How to get sum of all values until a specific key is reached in dictionary

I am new to python and have a doubt regarding dictionary operations. I am maintaining a dictionary as follows - dict = {counter:distance}. For example - dict = {1:1, 2:10, 3:27, 4:10, 5:7, ...

1 answer

Python 3 DictWriter csv BytesIO TypeError

I'm using python 3 trying to generate a csv on the file. I want to ensure that I'm writing utf8 so I'm converting values of my list of dicts into byte strings field_order = ['field1', 'field2', ...

0 answers

Stopping an animation - matplotlib

I have the following function that updates a figure and displays in real time. I am trying to save the animation to an MP4 using the following code: def updategal(*args): global ...

0 answers

Tweepy “from urllib import quote”

I'm trying to use tweepy for a Twitter project. I have written just some starting code thus far (I have my keys and tokens stored in the variables already, just not going to post them online here!): …

1 answer

Django: static files returning 404 error

I want to be able to load my static files on my local server, but when I request them, the browser returns 404 for every resource. From what I can understand, STATIC_URL is the url in which my ...

1 answers | 1 hour ago by Lambin on Stack Overflow stackoverflow.com
1 answer

Python calculate speed, distance, direction from 2 GPS coordinates

How do I calculate the speed, distance and direction (degrees) from 2 GPS coordinates in Python? Each point has lat, long, time. I found the Haversine distance calculation in this post: Calculate …

1 answers | 1 hour ago by user231302 on Stack Overflow stackoverflow.com
1 answer

Why would the Drupal installation be selectively not responding?

I don't know what has happened, we updated the Drupal installation, some of the modules and suddenly the installation stopped working properly. The site by itself looks normal and so does the admin …

1 answers | 1 hour ago by jakobhans on Stack Overflow stackoverflow.com
2 answers

Running python programs on android

First of all I apologize that I am not a programmer and my IT knowledge is limited. I have written a very basic python program which runs on windows. I just want to run it on my android phone. I ...

2 answers

A better way to load MongoDB data to a DataFrame using Pandas and PyMongo?

I have a 0.7 GB MongoDB database containing tweets that I'm trying to load into a dataframe. However, I get an error. MemoryError: My code looks like this: cursor = tweets.find() #Where tweets …

2 answers

How to solve “Unresolved import: HTML” in Python Development?

I'm starting to learn about python development in a new project. I got setup almost everything right, but only this import HTML that keeps given me some error that I don't know how to solve it. ...

2 answers

same row multiple times in a form in django

have a form by which user can enter details about some expenses but i want to have same row in the form again and again but couldn't find out how to do that : if you see figure above this forms ...

1 answer

module to change view field value in drupal

I need to write php code to change my view's field value. I have a php template file, under the theme, and the code is like: $view = views_get_view_result("gallery"); $count = count($view); if ...

1 answers | 1 hour ago by user2730676 on Stack Overflow stackoverflow.com
1 answer

import data of models.py with 2 class into template

I am a amature django developer. I have a model with two class called "Post" and "Catagory". I want to read Category items in my template. How can I import my category in my template and show it's ...

1 answers | 1 hour ago by user1788781 on Stack Overflow stackoverflow.com
2 answers

Python randomising multiple choices in python

What I try to do is randomise the question1 to question20 in different order and when it's randomise I can also type my answer in the question. Every time I try to use the randomise statement it's …

2 answers | 1 hour ago by markercup on Stack Overflow stackoverflow.com
1 answer

Python Decimal type precision error

I have a quite puzzling issue that I suspect has to do with scientific notation and decimal precision. Here is part of my code: def atan(x): # Calculate arctan(1/x) x = ...

0 answers

Neural Network sigmoid function

I'm trying to make a neural network and I have a couple of questions: My sigmoid function is like some s = 1/(1+(2.7183**(-self.values))) if s > self.weight: self.value = 1 else: …

1 answer

Upload File using Angular and Django

So, I have a issue that i cant find a solution for. I am developing an application using Django where my front end has to be in angular-js. Now I am able to render forms and also post the data from …

1 answer

AWS boto check if security group or other elements is ready

I'm creating a VPC and security groups with boto. If I just create and tag elements in a script I keep getting errors, because the elements aren't ready yet. I can just put in a manual wait, but I …

1 answer

Error when mocking modules with the patch decorator in Django

I'm learning about mocking in Django but can't seem to get my head around patching. The test_get_name passes but test_patched_get_name fails with ValueError: Object is of type 'MagicMock', but must …

1 answers | 2 hours ago by greenafrican on Stack Overflow stackoverflow.com
1 answer

Call C function inside a C extension in Python

I've tried to make a C extension to Python. My problem is that I have C function calls inside the C function I have made a C extension for. For example I am using C functions in pmd.h and usb1024LS.h …

1 answers | 2 hours ago by Øystein A. Smith on Stack Overflow stackoverflow.com
15 30 50 per page
1 2 3