Tagged Questions
Python is a dynamic and strongly typed programming language that is designed to emphasize usability. Two similar but incompatible versions of Python are in widespread use (2 and 3). Please consider mentioning the version and implementation that you are using when asking a question about Python.
0
votes
0answers
9 views
Why can't node handle this regex but python can?
I have a large text file that I am extracting URLs from. If I run:
import re
with open ('file.in', 'r') as fh:
for match in re.findall(r'http://matchthis.com', fh.read()):
print match
it ...
0
votes
0answers
10 views
Indexing Numpy arrays with arrays
This question is a little more abstract than finding the solution with actual code. I am trying to understand some code for some software I am working with. Specifically, I am working with a 4D numpy ...
0
votes
0answers
7 views
What is the format of the .tar.gz file for setting up firefox preference from selenium python?
What is the format of the .tar.gz file for setting up firefox preference from selenium python?
from selenium import webdriver
profile = webdriver.FirefoxProfile()
...
0
votes
0answers
9 views
scheduling facebook posts with python
I'm currently trying to schedule a post to a business Facebook page I'm working on.
What it needs to do is post a different image that's sitting on Amazon S3 everyday at 12pm. The script will be run ...
0
votes
1answer
10 views
Specific Punctuation Stripping Python
Now, I'm aware of the thousand or so questions that have already been answered regarding punctuation stripping. However mine is a bit different than the ones I've looked at.
I need a code that strips ...
0
votes
1answer
10 views
How to flashing a message with link using Flask flash?
I'm creating a web app using Flask to deal with GoogleOpenID, these codes are almost finished, except the flashing message contains a link:
@oid.after_login
def create_or_login(resp):
user = ...
0
votes
1answer
15 views
Raises NameError:name xx is not defined
My program got a strange problem, the exception stack is:
*except Exception, cause: raise ExprEvalError(src, cause)
ExprEvalError: date_after raises NameError: name 'date_after' is not defined*
so ...
1
vote
5answers
26 views
List indices must be integers, not str
I am trying to do something like the code below in Python
PHP Code:
if(!$my_data[$n_vertex]['visited']){
$my_data[$n_vertex-1]['visited'] = true;
}
What i am exactly doing in Python
...
0
votes
1answer
26 views
Python selection sort debug
I am trying to write a selection sort function. There is a bug appears and I dont know how to
fix it.Here is my code:
def selection_sort(numbers):
outlist=[]
for i in range(len(numbers)-1):
...
0
votes
0answers
20 views
Visualize data on maps using Python
I want to create a heatmap of say, provincial population of China and I found this guide to a similar problem http://sensitivecities.com/so-youd-like-to-make-a-map-using-python-EN.html#.Ut3k7bS-thF ...
1
vote
1answer
12 views
Getting data out of tags (BeautifulSoup)
Brief explanation: I have a script which loops through elements of a page, then returns the data. But I want it to return data which is not in an element, but in order.
import argparse, os, socket, ...
0
votes
1answer
7 views
How do I install py2app onan off-internet PC
I have downloaded py2app, but the problem is that easy install seems to be an online installation, yet I am installing this on an off-line pc, so can't use easy install. I expected to be able to ...
-8
votes
2answers
23 views
split a line and print in second line
I have input file like this
@HWI-ST1072:185:C325WACXX:1:1101:8553:1994:1:N:#CAGATT
NGGGGCGATAGAGTAAGATTTTATTTTAAAAAAAAAAAAAAAAATTTAAAA
+
#0<FFBBFFFFFFFBFBFFIIIIIIIIIIIIIIIIIFFFFFB#########
...
0
votes
1answer
15 views
Why does my python class method behave differently by itself than when I run the module?
I am making a small text game, and one of my methods is behaving unexpectedly, and I can't figure out why. If I import the module and run the method in python, it works fine. Some parts of the game ...
-2
votes
1answer
13 views
matplotlib plotting dictionary keys as column labels
I'm tripping over my feet here with this very simple task.
I want to plot as a bar chart in matplotlib, where the keys are the labels of the columns, and the height of each bar is the value.
e.g.
...