1
vote
3answers
25 views

Enter data in dictionary from 2 array in python

I have 2 following arrays which i want to merge in a dictionary. Input:wrd=['i','am','am','the','boss','the','tiger','eats','rice','eats','grass'] cnt=[0,1,2,3,4,5,6,7,8,9,10] ...
2
votes
0answers
28 views

Asserts in Pyton 2.7 not working for me example assertIn

I have python 2.7 installed on my Mac. (verified by running python -v in terminal) When I try to use any of the new 2.7 assert methods I get AtributeError. I have looked at ...
1
vote
3answers
47 views

How to use map() to call class methods on a list of objects

I am trying to call object.method() on a list of objects. I have tried this but can't get it to work properly newList = map(method, objectList) I get the error method is not defined but I know ...
1
vote
1answer
27 views

strange visibility scope behaviour in python

Have a strange behavior with scope visibility, and I couldn't find this in the manuals. So, here is the piece of my code simplified to the base. from server import WWW_DOCUMENT_ROOT def ...
1
vote
2answers
25 views

How to send to client dictionary which contains utf characters with simplejson?

I have in dictionary under key "verb" string which contains non ascii characters (utf-8). I want to send to client that dictionary (I am using Tornado i Python 2.7.2 and simplejson). I am trying like ...
0
votes
1answer
15 views

How to get following sibling of an etree._Element

I am iterating over elements which I find in a xml file like so: for elem in fileasxml.xpath("//elementname[some condition]"): do something Now instead of do something I'd like to write the ...
1
vote
4answers
69 views

Trouble finding the 1000th prime using python [duplicate]

I am self learning Python from the MIT open courseware website. I am having trouble completing this assignment using only the information learned in the lectures. The last thing I learned was ...
0
votes
0answers
48 views

free variables in nested function in python

What exactly are free variables in nested functions scenario in python. Would anyone please explain in detail what they are useful for and how they are differ from normal variables?
0
votes
1answer
15 views

QT : Disable keyboard shortcut for quitting mac application or identify allow only closebutton event to quit application

In Mac Command + Q keyboard shortcut quits most of the applications. In my case, I want to disable it for my application which I have developed in QT. Or Is there any way to identify the close event ...
0
votes
1answer
15 views

Kivy - adding and removing labels

I'm new to Kivy, and can't find any real answers about adding and removing labels. I worked my way through the Pong tutorial (as you might have guessed), and adapted it for 4 players. Now, I'm trying ...
2
votes
1answer
36 views

.Bat To .Py Rewrite

I'm attempting to rewrite this small .bat script into a .py file mainly for practice but i'm having alot of trouble getting the the whole shutil module working in my favor there seem's to be alot of ...
0
votes
2answers
43 views

How to sort through a bible.txt by entering the name, verse etc.?

Here are my criteria: Get a copy of the text of the whole bible This should be ready to open, read, split up into fields Use this to create a persistent dictionary variable called bible Set up ...
0
votes
1answer
13 views

Python: using reuests library for multipart/form-data

I am fairly a noob at this and have been trying to use requests modules to post a multipart/form-data. To clarify, the exact test case I am trying to use is the one same as in ...
0
votes
1answer
36 views

Is accepting special characters for a range within a regex pattern possible?

I have a list of items stored in a variable as shown below: listitems = ['<a href=\"\/other\/end\/f1\/738638\/adams\">Adams<\/a>\n', '<a ...
0
votes
1answer
19 views

Accessing the original value of the unicode string when subclassing unicode

Try to get a class which would work like so: >>> original = u"ABCD-123-foo" >>> suffix = SuffixComparingUnicodeString("foo") >>> suffix == original # if original ends ...

1 2 3 4 5 400
15 30 50 per page