0
votes
0answers
2 views

How do I open a webpage with BeautifulSoup and output a text file?

How do I use BeautifulSoup to find all letters from yahoo.com containing the letter M and output it to a txt. file? I have tried the script below: from bs4 import BeautifulSoup import urllib2 url = ...
1
vote
4answers
22 views

Hints for nested context managers in a Python 2.6- / Python 3-neutral way?

I have been using a lot of context managers as a clean way of composing various setup/teardown situations. Since my deployments target Python 2.6, this means using contextlib.nested. Lately I've ...
3
votes
4answers
53 views

breaking up long path names

I am having trouble breaking the path into two lines in my python compiler. It is simply a long path on the compiler screen and i have to stretch the window too wide. I know how to break a ...
0
votes
1answer
27 views

Combining eol characters with placeholders

I have to loop through some numbers in an array and output them nicely formatted. How can I combine the end of line character with a placeholder? I have this: for i in range(0,4): print("%.2f", ...
2
votes
2answers
49 views

Why use setattr() and getattr() built-ins?

From reading the docs, I understand exactly what getattr() and setattr() do. But it also says explicitly that getattr(x, 'foobar') is equivalent to x.foobar and setattr(x, 'foobar', 123) is equivalent ...
0
votes
1answer
25 views

Repeat an action a specified amount of times

Just for the record I'm just starting to use python (you can tell by the username),and I want to make it multiply a variable (let's call it X) by 2 and then the next time it comes back to this line to ...
2
votes
1answer
46 views

Why is my code slow (does it even work)? [Project Euler 12][Python 3.3]

I wrote this code for Project Euler #12. It's very slow (or doesn't work) and I found another code that is very similar and gets the answer immediately. My code: import math def get_triangular(nth): ...
0
votes
1answer
14 views

Event during an annimation tkinter python3

I'm programming a little game with tkinter and I need get events during main animation. My annimation is a kind of infinite loop like that : def animation(self): while 1: ... ... ...
2
votes
2answers
31 views

Generate zip stream without using temp files

I've got a python method which needs to collect lots of data from an API, format it into a CSV, compress it and stream the result back. I've been Googling and every solution I can find either ...
-4
votes
0answers
37 views

How do you make Python 3 always respond to a particular input? [on hold]

I'm new to programming and I'm trying to create a basic text based game, where a player can accumulate items, such as money. I wish to create some sort of way that the player can check their wealth ...
0
votes
1answer
26 views

python 3 open terminal and run program

I made a small script in sublime that will extract commands from a json file that is on the user's computer and then it will open the terminal and run the settings/command. This works, except that it ...
-1
votes
0answers
44 views

stand alone application like Skype using django? [on hold]

Can I develop stand-alone application like Skype using django? I am new in development and have not found any help. I need to create it from scratch. Any help would be appreciated. Thanks
-2
votes
3answers
43 views

Accessing list of list returned by itertools.product Python

Python Script, Looks like as below, >>> a=[[1,2,3],[4,5,6],[7,8,9,10]] >>> b=itertools.product(*a) >>> b Now b will contain following elements , [(1,4,7),(1,4,9), ...
0
votes
0answers
58 views

Mastermind solver performance issues

I am creating a mastermind solver, but my guess choosing function is taking way too long. How it works in plain English: Compare a guess candidate to every other possible code in the list of ...
-2
votes
2answers
50 views

Python 3 How to change a class 'str' to class 'int'?

I am using qpython3. The class not changed by int(). Here is sample code in qpython3 console. >>> a = "8" >>> a '8' >>> type(a) <class 'str'> >>> int(a) 8 ...

15 30 50 per page