How can I retrieve the page title of a webpage using Python?
How can I retrieve the page title of a webpage (title html tag) using Python? ...
How can I retrieve the page title of a webpage (title html tag) using Python? ...
Say I have the following 2 methods: def methodA(arg, **kwargs): pass def methodB(arg, *args, **kwargs): pass In methodA I wish to call methodB, passing on the kwargs. However, it seems if I simply do: def methodA(arg, **kwargs): methodB("argvalue", kwargs) The second argument will be passed on as positional rather than...
I've been really enjoying Python programming lately. I come from a background of a strong love for C-based coding, where everything is perhaps more complicated than it should be (but puts hair on your chest, at least). So switching from C to Python for more complex things that don't require tons of speed has been more of a boon than a ba...
Given a path such as "mydir/myfile.txt" How do I find the absolute filename relative to the current working directory in Python? E.g. on Windows, I might end up with: "C:/example/cwd/mydir/myfile.txt" ...
I need a real DBA's opinion. Postgres 8.3 takes 200 ms to execute this query on my Macbook Pro while Java and Python perform the same calculation in under 20 ms (350,000 rows): SELECT count(id), avg(a), avg(b), avg(c), avg(d) FROM tuples; Is this normal behaviour when using a SQL database? The schema (the table holds responses to a s...
I need a way to determine the space remaining on a disk volume using python on linux, Windows and OS X. I'm currently parsing the output of the various system calls (df, dir) to accomplish this - is there a better way? ...
What are the best libraries for creating pretty charts and graphs in a Python application? ...
I have a file that I want to include in Python but the included file is fairly long and it'd be much neater to be able to split them into several files but then I have to use several include statements. Is there some way to group together several files and include all at once? ...
I have a long line of code that I want to break up among multiple lines. What do I use and what is the syntax? For example, adding a bunch of strings: e = 'a' + 'b' + 'c' + 'd' have it like this: e = 'a' + 'b' + 'c' + 'd' ...
I want to scrape some information off a football (soccer) web page using simple python regexp's. The problem is that players such as the first chap, ÄÄRITALO, comes out as ÄÄRITALO! That is, html uses escaped markup for the special characters, such as Ä Is there a simple way of reading the html into the correct python st...
Given a reference to a method, is there a way to check whether the method is bound to an object or not? Can you also access the instance that it's bound to? ...
I'm evaluating and looking at using CherryPy for a project that's basically a javascript front-end from the client-side (browser) that talks to a Python web service on the back-end. So, I really need something fast and lightweight on the back-end that I can implement using Python that then speaks to the PostgreSQL db via an ORM (JSON to ...
For example, if passed the following: a = [] How do I check to see if a is empty? ...
Having tries to target two of these environments at the same time I can safely say the if you have to use a database etc. you end up having to write unique code for that environment. Have you got a great way to handle this situation? ...
I am trying to automate functional testing of a server using a realistic frequency distribution of requests. (sort of load testing, sort of simulation) I've chosen the Weibull distribution as it "sort of" matches the distribution I've observed (ramps up quickly, drops off quickly but not instantly) I use this distribution to generate t...
I am trying to implement AJAX in my Google App Engine application, and so I am looking for a good AJAX framework that will help me. Anyone has any idea? I am thinking about Google Web Toolkit, how good it is in terms of creating AJAX for Google App Engine? ...
What is the difference between old style and new style classes in Python? Is there ever a reason to use old-style classes these days? ...
I'm building a Django project that needs search functionality, and until there's a django.contrib.search, I have to choose a search app. So, which is the best? By "best" I mean... easy to install / set up has a Django- or at least Python-friendly API can perform reasonably complex searches Here are some apps I've heard of, please sug...
Dictionaries unlike lists are not ordered (and do not have the 'sort' attribute). Therefore, you can not rely on getting the items in the same order when first added. What is the easiest way to loop through a dictionary containing strings as the key value and retrieving them in ascending order by key? For example, you had this: d = {...
I use Emacs primarily for coding Python but sometimes I use IDLE. Is there a way to change the key bindings easily in IDLE to match Emacs? ...