Starting from an Html input like this:
<p>
<a href="http://www.foo.com">this if foo</a>
<a href="http://www.bar.com">this if bar</a>
</p>
using BeautifulSoup, i would like to change this Html in:
<p>
<a href="http://www.foo.com">this if foo[1]</a>
<a href="http://www.bar.com">this if bar[2]</a>
</p>
saving parsed links ...
hi, people.
i'm writing web-server that responds me with a list of files in some folder:
test_folder = 'somefolder'
class TestLoader(object):
data = []
index = 0
def __init__(self, dir):
for sub in os.listdir(dir):
self.data.append(sub)
class TesterServer(object):
@cherrypy.expose
def index(self)...
Hello.
I have made a C++ library and have built a .dylib dynamic library from it. However when I load it with ctypes, it fails. Something doesn't seem to have linked properly. I have no idea why. The error (The relevant part):
cscalelib.setup_framebuffer(flip,surface.frame_buffer,surface.texture,surface._scale[0],surface._scale[1])...
I wanted to design a simple site where one person can upload a file, and pass off the random webaddress to someone, who can then download it.
At this point, I have a webpage where someone can successfully upload a file which gets stored under /files/ on my webserver.
The python script also generates a unique, random 5 letter code that ...
Using pyodbc, if I try and execute this code on a date field:
cursor.execute('insert into test VALUES (?)', None)
... I get pyodbc.Error: ('HY000', '[HY000] [SAS][SAS ODBC Driver][SAS Server]ERROR: Value 1 of VALUES clause 1 does not match the data type of the corresponding column in (-1) (SQLExecDirectW)'), while if I execute this:
...
Hi,
I have access to a grid (running condor) that would (potentially) allow to very substantially reduce how long by nltk based nlp tasks take. unfortunately, i dont have root access on the cluster so cannot install new packages, only run whatever is available on the linux boxes.
python is of course available, but nltk isnt - i was won...
In Python, can an object have another object as an attribute? For example, can a class called car have a class called tire as an attribute?
...
I need to know what language it returns, so that I can perform my own actions.
...
I'm trying to define my own (very simple) exception class in Python 2.6, but no matter how I do it I get some warning.
First, the simplest way:
class MyException(Exception):
pass
This works, but prints out a warning at runtime: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6 OK, so that's not the wa...
Looking for best practice advice on what string substitution technique to use when using gettext(). Or do all techniques apply equally?
I can think of at least 3 string techniques:
1) Classic "%" based formatting:
"My name is %(name)s" % locals()
2) .format() based formatting:
"My name is {name}".format( locals() )
3) string.Templa...
Say I have some data like this:
number_stream = [0,0,0,7,8,0,0,2,5,6,10,11,10,13,5,0,1,0,...]
I want to process it looking for "bumps" that meet a certain pattern.
Imagine I have my own customized regex language for working on numbers, where [[ >=5 ]] represents any number >= 5. I want to capture this case:
([[ >=5 ]]{3,})[[ <3 ]]{2...
Greetings! Last semester in college, my teacher in the Computer Languages class taught us the esoteric language named Whitespace. In the interest of learning the language better with a very busy schedule (midterms), I wrote an interpreter and assembler in Python. An assembly language was designed to facilitate writing programs easily, an...
I have two programs, sendfile.py and recvfile.py that are supposed to interact to send a file across the network. They communicate over TCP sockets. The communication is supposed to go something like this:
sender =====filename=====> receiver
sender <===== 'ok' ======= receiver
or
sender <===== 'no' ======= receiver
if o...
I want to enable someone login using facebook,
Is there a framework that you have used to do this?
Thanks
...
How do I set, temporarily, the PYTHONPATH environment variable just before executing a Python script?
In *nix, I can do this:
$ PYTHONPATH='.' python scripts/doit.py
In Windows, this syntax does not work, of course. What is the equivalent, though?
...
heya,
I have a Excel .CSV file I'm attempting to read in with DictReader.
All seems to be well, except it seems to omit rows, specifically those with missing columns.
Our input looks like:
mail,givenName,sn,lorem,ipsum,dolor,telephoneNumber
[email protected],ian,bay,3424,8403,2535,+65(2)34523534545
[email protected],mike,gibson,342...
when i run development server it works very well, even an empty project runing in mod_wsgi i have no problem but when i want to put my own project i get an Internal Server Error (500)
in my apache conf i put
WSGIScriptAlias /codevents C:/django/apache/CODEvents.wsgi
<Directory "C:/django/apache">
Order allow,deny
Allow from all
</Dir...
I have simple map-reduce type algorithm, which I want to implement in python and make use of multiple cores.
I read somewhere that threads using native thread module in 2.6 dont make use of multiple cores. is that true?
I even implemented it using stackless python however i am getting into weird errors
[Update: a quick search showed t...
Hello
I've created my new site using DjANGO
AT FIRST Everything is okay startapp,syncdb......Etc
but the problems its this massage
Unhandled Exception
An unhandled exception was thrown by the application.
you can see
http://www.daqiqten.com/
this is my index.fsgi and .htacces
index.fcgi
#!/usr/bin/python
import sys, os
# Add a c...
I'm 21 and am pretty efficient in html/css, python, and javascript. I also know my way around lisp languages and enjoy programing in them. My problem is that I'm extremely self-taught and not quite confident that I could land a job programing, but I really need a job soon as I've just become a father.
I haven't even created a resume yet...