1
vote
2answers
25 views

Title case for a paragraph

I'm creating a markov chain algorithm. I output a variable called sentences which contains one string of sentences. I want to make the sentences sentence case so I wrote this: for l in range(0, ...
0
votes
1answer
15 views

What's the difference between entity.put() and entity.save()?

I see in the gae manpages that entity.save() is not very documented but still it can be used. What is the difference between entity.put() and entity.save()? Should save() never be used and only put() ...
1
vote
3answers
27 views

How do I parse some of the data from a large xml file?

I need to extract the location and radius data from a large xml file that is formatted as below and store the data in 2-dimensional ndarray. This is my first time using Python and I can't find ...
-9
votes
0answers
38 views

python won't handle unicode correctly [closed]

Python won't handle unicode correctly: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128) Traceback (most recent call last): File ...
0
votes
3answers
36 views

Joining value(list) from <key, value> in dictionary

I have a dictionary in format {'string-value-keys':[list-values]}. For a particular key value, I would like to retrieve the value as a string. Here is the example: >>> simpleDict= ...
0
votes
0answers
13 views

python 2.6 python 2.7 mmap issue

So, I try to mmap a file of around 40GB and I try to do a few mmap search, slice and write operations. For some reason, in python 2.6 it took a lotttttt of time to do the mmap (infact it was never ...
0
votes
0answers
22 views

interesting weird python 2.7 mmap issue

So, I am facing a very weird issue with mmap and I wanted to know if anyone could offer an insight into how I could go about debugging the root cause. Given -: an original xml file (40GB) that ...
0
votes
1answer
42 views

Mapping user id onto a dict comparing to see if user is already in dict

I have code which currently prints out data for each user from an XML file (obtained from a website) the XML updates as more users interact with it throughout the day. I currently have my code looping ...
0
votes
0answers
7 views

Issue in using 'Mechanize' along with 'Cookielib' to extract data from website

I am trying to scrape a website that requires 'Mechanize' module to be used along with 'Cookielib'. When I try to open the webpage directly using BeautifulSoup in Python, it gives an 'HTTPS ...
0
votes
1answer
36 views

python 2.7 random sampling causes memory error

random.sample(range(2**31 - 1), random.randrage(1, 100)) This results in: Traceback (most recent call last): File "<stdin>", line 1, in <module> MemoryError I'm running python 2.7.3 ...
4
votes
4answers
63 views

Finding the first list element for which a condition is true [duplicate]

I was looking for an elegant (short!) way to return the first element of a list that matches a certain criteria without necessarily having to evaluate the criteria for every element of the list. ...
0
votes
2answers
53 views

Calling python script from C++ and using its output

I want to call a python script from C++ and wish to use the output .csv file generated by this script back into C++. I tried this in main(): std::string filename = "/home/abc/xyz/script.py"; ...
1
vote
0answers
6 views

Texturing on 3d Blocks using pycollada

I am developing a python script which will be able to generate .DAE (COLLADA) files along with the associated KML files for developing 3D models of buildings. I have the street images of the ...
-1
votes
0answers
20 views

Recommended Python RSS feed generator? [closed]

I am looking to output the results of my current web scraping project as an RSS feed, as would be standard I checked stack overflows top questions to see what the communities consensus was on possible ...
2
votes
1answer
52 views

Cannot store Greek in datastore

I have a serious problem with my google app engine app. Until now, anything I store on database, was on english. Now I have to store few things on greek and when I try to retrieve it later from the ...
0
votes
1answer
13 views

Module Import Error running py.test with modules on Path

I'm unable to import my module for testing in the way that I'd like. I'm running all of this in a virtualenv on 2.7.2 I have a directory structure like /api /api __init__.py ...
8
votes
1answer
148 views

Is “join” slower in 3.x?

I was just messing around when I came across this quirk. And I wanted to make sure I am not crazy. The following code (works in 2.x and 3.x): from timeit import timeit print ('gen: %s' % ...
2
votes
1answer
59 views

Beautiful Soup returning nothing

Hi I am working on a project for my school that involves scraping off the HTML. However I get none returned when I look for tables. Here is the segment that experiences the issue. If you need more ...
0
votes
1answer
24 views

Pygame sprite assistance

I've basically just started developing with PyGame and I am having trouble with the whole Sprite concept. I have been looking every where for guides on how to use it, I just can't seem to find any. I ...
4
votes
2answers
51 views

Copy using the Windows copy dialog

I'm currently using shutil.copy2() to copy a large number of image files and folders (anywhere between 0.5 and 5 gigs). Shutil works fine, but it's so slow. I'm wondering if there is a way to pass ...
0
votes
0answers
86 views
+50

Windows drops connection when new data received to socket

I've a service made with twisted. Everything had worked fine until I've moved to a new server. Now my service drops most of connections when new data received. Old server was 32 bit Windows XP and the ...
0
votes
1answer
54 views

Python facebook desktop application

I'm trying to make a desktop application in python 2.7 (I'm using python-facebook-sdk) which would allow user to log into his account and then do some basic actions (like displaying his wall messages, ...
-5
votes
5answers
206 views

Python : in python is it true you can import specific functions from a module unlike in php?

in php it is not possible to only get specific functions from an included file. i would usually create 5 different include files and each would have like 5-6 functions in it. this way it would be ...
0
votes
1answer
69 views

Importing functions bad, classes okay?

Just a style question but I'm working on a project where the style guidelines frown upon from foo import bar when bar is a function but not when bar is a class. I don't understand the rationale ...
5
votes
0answers
175 views

Read Matlab matrix into Python

When I'm trying to read a Matlab matrix into python, I get the following error >>> scipy.io.loadmat("Dynamical.mat") Traceback (most recent call last): File "<stdin>", line 1, in ...
1
vote
4answers
205 views

Calling external program through Python and passing the output to stdout

How can I call an external program which is written in bash script in such a way that the output produced by that script is available in sys.stdout so that I can log the output in a file through ...
1
vote
1answer
99 views

Pyschool: Topic 1

I am new to Python and i jumped right into python 3. However i am trying to use the learning practices from pyschools.com. I have run into a question that deals with using strings. They want this ...
0
votes
2answers
434 views

Python traceback module for beginners

I am new to python and am finding it difficult to understand the official document for the traceback module http://docs.python.org/release/3.1.5/library/traceback.html If someone could please guide ...
13
votes
3answers
1k views

Multiple keys per value

Is it possible to assign multiple keys per value in a Python dictionary. One possible solution is to assign value to each key: dict = {'k1':'v1', 'k2':'v1', 'k3':'v1', 'k4':'v2'} but this is not ...
9
votes
4answers
17k views

Python: Print to File

Why does trying to print directly to a file instead of sys.stdout produce the following syntax error: Python 2.7.2+ (default, Oct 4 2011, 20:06:09) [GCC 4.6.1] on linux2 Type "help", "copyright", ...

1 2 3 4 5 165
15 30 50 per page