Tagged Questions
1
vote
2answers
26 views
Printing on the same line with value returned from Python 2.7 function
Using , we are able to have several print statements write on the same line.
print 'hello',
print 'world'
Problem: When print the value returned by a function, how do I print the values returned by ...
2
votes
1answer
33 views
A Python Segmentation Fault?
This generates a Segmentation Fault: 11 and I have no clue why.
Before I get into it, here's the code:
import numpy.random as nprnd
import heapq
import sys
sys.setrecursionlimit(10**6)
def ...
0
votes
1answer
46 views
Python counting words in large file
I have a 6M row database(sqlite) containing 4 fields: id(integer)|title(text)|text(text)|tags(text).
Now I need to count the occurrence of each word appeared in title for example and import into ...
1
vote
1answer
15 views
Unable to get matplotlib working with code for a simple plot
I tried to install matplotlib using pip install matplotlib and it retuned the following error. For reference I am using windows 7.
Removing temporary dir ...
0
votes
3answers
47 views
Splitting string in python
I would like to split a sting in python the most efficient way, and the most "python-like" way.
Say I have this string:
s = '"Jens", "kasper", "Michael"'
How do I achieve the following list:
...
0
votes
1answer
14 views
Python action freezes the program
I have this little program I wrote, In it there is a class of methods, and a class that build the window (only one).
from Tkinter import *
from tkMessageBox import *
import socket
import platform ...
0
votes
0answers
33 views
Python Version Issues With 2.7
I am Mac user and I have been using 2.6 for quiet sometime. And I had to upgrade it to 2.7 for some reason.
Now it keeps throwing some packages aren't available like httplib2 etc.,
when I checked in ...
1
vote
0answers
21 views
Calculating number of occurrences of dual parameter match in a csv appending the results to csv
What I need to do is calculate the following:
The number of times a person appears in the list (column 8) on dates prior to the date specified in the row with the same t data in column 10 and a 1 ...
0
votes
0answers
12 views
Error trying to coexist Python 2.7.5 and Python 3.3.2 on Windows 7
I'm hearing the call to move my Python code from 2 to 3, so I'm trying to setup Python 3 on my Windows 7 box that already has Python 2.7.5 on it. The python 2 version is 64 bit and so is the Python 3 ...
0
votes
1answer
22 views
Coerce UTF bytestream to ASCII
I am aware that csv won't handle UTF directly, and that part of the solution is to open the file using codecs which opens the stream using the right encoding. I still get the error however:
...
2
votes
3answers
62 views
To convert string to variable name in python [duplicate]
I have any string. like 'buffalo',
x='buffalo'
I want to convert this string to some variable name like,
buffalo=4
not only this example, I want to convert any input string to some variable ...
0
votes
0answers
18 views
How do you get the directory path for a pyinstaller executable?
I'm on mac osx 10.7.5 running python 2.7
I'm trying to create a one file executable with pyinstaller, that recurses through the directory it's located in. I have this working as a python script, ...
0
votes
2answers
50 views
Cannot read in files
I have a small problem with reading in my file. My code:
import csv as csv
import numpy
with open("train_data.csv","rb") as training:
csv_file_object = csv.reader(training)
header = ...
1
vote
0answers
20 views
cross-compiling Python 2.7.4+
There are several tutorials on the web documenting how to cross-compile or cross-build Python for various embedded systems using some basic hacking and patching, like so:
...
-1
votes
1answer
30 views
Error running python scripts
When running scrapy basic programs, which have a known surety of working on others systems. I get the following error.
"C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", ...