I want to grab the value of a hidden input field in HTML.
<input type="hidden" name="fooId" value="12-3456789-1111111111" />
I want to write a regular expression in Python that will return the value of fooId, given that I know the line in the HTML follows the format
<input type="hidden" name="fooId" value="**[id is here]**" />
Can ...
According to the documentation, they're pretty much interchangeable. Is there a stylistic reason to use one over the other?
...
I'm currently trying ElementTree and it looks fine, it escapes HTML entities and so on and so forth. Am I missing something truly wonderful I haven't heard of?
This is similar to what I'm actually doing:
import xml.etree.ElementTree as ET
root = ET.Element('html')
head = ET.SubElement(root,'head')
script = ET.SubElement(head,'script')
...
We're at the beginning of a new ERP-ish client-server application, developed as a Python rich client. We're currently evaluating Dabo as our main framework and it looks quite nice and easy to use, but I was wondering, has anyone used it for medium-to-big sized projects?
Thanks for your time!
...
The documentation for the round() function states that you pass it a number, and the positions past the decimal to round. Thus is should do this:
n = 5.59
round(n, 1) # 5.6
But, in actuality, good old floating point weirdness creeps in and you get:
5.5999999999999996
For the purposes of UI, I need to display '5.6'. I poked around t...
Can you recommend a feed generator library for Python? I could build the XML myself, but I'm looking for a recommended library that is built from the ground up around the RSS (or Atom) spec.
...
I'm doing some web scraping and sites frequently use HTML entities to represent non ascii characters. Does Python have a utility that takes a string with HTML entities and returns a unicode type?
For example:
I get back:
& #x01ce; (There is no space. I put that so Markdown won't interpret it)
which represents an "a" with a tone mark...
I can't tell from the Python documentation whether the re.compile(x) function may throw an exception (assuming you pass in a string). I imagine there is something that could be considered an invalid regular expression. The larger question is, where do I go to find if a given Python library call may throw exception(s) and what those are? ...
When I call socket.getsockname() on a socket object, it returns a tuple of my machine's internal IP and the port. However, I would like to retrieve my external IP. What's the cheapest, most efficient manner of doing this?
...
I like doxygen to create documentation of C or PHP code. I have an upcoming Python project and I think I remember that Python doesn't have /* .. */ comments and also has its own self-documentation facility which seems to be the pythonic way to document.
Can I just use doxygen? Anything particular to be aware of?
I have done some coding...
I have been playing with the Ruby library "shoes". Basically you can write a GUI application in the following way:
Shoes.app do
t = para "Not clicked!"
button "The Label" do
alert "You clicked the button!" # when clicked, make an alert
t.replace "Clicked!" # ..and replace the label's text
end
end
This made me think - how...
I want to begin to learn Python, and I've seen that phrase come up here before, but I don't know exactly what it means. I've read some websites on Python scripting, but I don't recall ever seeing that (but I could have just glanced over it).
What exactly makes something "pythonian" or "pythonic"?
...
Anyone came across something like Dive Into Python for Ruby? Something that:
Gets the language knowledge across by examples of real code that does something useful not just trivial one-liners
Is ment for experienced programmers, not newbies (i.e. does not explain obvious stuff like object-orientation and what is a instance vs. class va...
I am writing a program to simulate the actual polling data companies like Gallup or Rasmussen publish daily: www.gallup.com and www.rassmussenreports.com
I'm using a brute force method, where the computer generates some random daily polling data and then calculates three day averages to see if the average of the random data matches poll...
Suppose the following:
>>>s = set([1, 2, 3])
How do I get a value (any value) out of s without doing s.pop()? I want to leave the item in the set until I am sure I can remove it - something I can only be sure of after an asynchronous call to another host.
Quick and dirty:
>>>elem = s.pop()
>>>s.add(elem)
But do you know of a bette...
Been scouring the net for something like firewatir but for python. I'm trying to automate firefox on linux. Any suggestions?
...
I want to write a function in python that returns different fixed values based on the value of an input index. In other languages I would use a switch or case statement, but python does not appear to have a switch statement. What are the recommended python solutions in this scenario?
...
If all my __init__.py files are empty, do I have to store them into version control, or is there a way to make distutils create empty __init__.py files during installation?
...
What is the best way to start developing Windows Mobile Professional applications in Python? Is there a reasonable SDK including an emulator? Is it even possible without doing excessive amount of underlaying Windows API calls for UI for instance?
...
Hi,
I'm looking for suggestions on possible IPC mechanisms that are:
cross platform (WIN32 and Linux at least)
Simple to implement in C++ as well as the most common scripting languages (perl, ruby python etc).
Finally, simple to use from a programming point of view!
What are my options? I'm programming under Linux, but I'd like what...