I have an application and need to write a program that is able to figure out attachments from all kinds of email senders (and MUAs) reliably. PHP doesn't seem to have a great MIME parser so I was hoping some other languages might.
I've seen the PHP Mail Mime Parser but it's not robust at all and I know (and have confirmed) it doesn't w...
as you can probably tell from my previous posts i have horrific naming conventions. do you know of any tutorials dealing with how to name stuff?
...
The P/Invoke Interop Assistant tool has been very helpful when I've had to marshal from c style structs into managed C# types. Are there any similar tools for the Python ctypes or struct modules?
...
I plan to start a mid sized web project, what language + framework would you recommend?
I know Java and Python. I am looking for something simple.
Is App Engine a good option? I like the overall simplicity and free hosting, but I am worried about the datastore (how difficult is it to make it similarly fast as a standard SQL solution? + ...
I came across a line of code using Python's numpy that looked like this:
~array([0,1,2,3,4,5,4,3,2,1,0,-1,-2])
And it gave the output:
array([-1, -2, -3, -4, -5, -6, -5, -4, -3, -2, -1, 0, 1])
Does the unary operator (~) take an array and apply A -> -(A+1)
If so, whats the point?
...
I have:
from __future__ import division
import nltk, re, pprint
f = open('/home/a/Desktop/Projects/FinnegansWake/JamesJoyce-FinnegansWake.txt')
raw = f.read()
tokens = nltk.wordpunct_tokenize(raw)
text = nltk.Text(tokens)
words = [w.lower() for w in text]
f2 = open('/home/a/Desktop/Projects/FinnegansWake/catted-several-long-Russian-nov...
Is it at all possible to use Pygments inside of wxPython to provide syntax highlighting?
...
I am trying to teach myself Python, and I have realized that the only way I really learn stuff is by reading the actual programs. Tutorials/manuals just cause me to feel deeply confused.
It's just my learning style, and I'm like that with everything I've studied (including natural languages -- I've managed to teach myself three of them...
I am currently interested in writing a python wrapper for some php code. I was wondering if there was practice for writing wrappers, in any language for that matter. I am mainly concerned with php for now.
Any tips and best practices would be appreciated.
Please and thank you.
...
Hi,
I am modifying the code found below to work as a CGI handler.
To enable CGI, I modified the HTTPRequestHandler to inherit from CGIHTTPRequestHandler instead. I changed the port to 4443 so that I could run it as non-root. I modified the .pem file to be ./server.pem, which is relative to the path the server script is running on.
To...
I am getting 500 Internal error with Apache and FastCGI. Spent the whole day to find the reason :-/
/etc/apache2/vhost.d/mysite.conf
FastCGIExternalServer /home/me/web/mysite.fcgi -socket /home/me/web/mysite.sock
Listen 80
<VirtualHost *:80>
ServerName os.me #That's my localhost machine
DocumentRoot /home/me/web
...
When running the program below from a command prompt in windows it keeps displaying the 'IndexError: list Index out of range', even when I am definitely adding a number argument eg.'bigdigits.py 123'
The program runs fine if I assign a string to 'digits' manually in the program eg. digits = '123'.
import sys
Zero = [" *** ", "* *", ...
This is an elaboration of a previous question, but as I delve deeper into python, I just get more confused as to how python handles csv files.
I have a csv file, and it must stay that way (e.g., cannot convert it to text file). It is the equivalent of a 5 rows by 11 columns array or matrix, or vector...which ever.
I have been attempti...
Hi
I want to do something similar to this
x = [1,2,3,4,5,6,7,8,9,0]
x
[1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
y = [1,3,5,7,9]
y
[1, 3, 5, 7, 9]
y-x which shouel give [2,4,6,8,0]
But this is not supported in python list
What is the best way of doing it?
...
Hi,
I have a list of integers, i.e.:
values = [55, 55, 56, 57, 57, 57, 57, 62, 63, 64, 79, 80]
I am trying to find the largest difference between two consecutive numbers. In this case it would be 15 from 64->79. The numbers can be negative or positive, increasing or decreasing or both. The important thing is I need to find the large...
How do I access the multiple xmlns declarations at the root element of an XML tree? For example:
import xml.etree.cElementTree as ET
data = """<root
xmlns:one="http://www.first.uri/here/"
xmlns:two="http://www.second.uri/here/">
...all other child elements here...
</root>"""
tree = ET.f...
Hello,
I am just starting to use a web framework. I have decided I really like python and started looking at web frameworks. I don't really like django for a few reasons, but from what I have tried so far I found I really like pylons.
The problem I have is that I can't find that many articles/tutorials about pylons, especially 1.0 art...
I am using beautifuly soup to find all href tags.
links = myhtml.findAll('a', href=re.compile('????'))
I need to find all links that have 'abc123' in the href text.
I need help with the regex , see ??? in my code snippet.
...
In my utf-8 encoded file, there are curly quotes (“”).
How do I replace them all with normal quotes (")?
cell_info.replace('“','"')
cell_info.replace('”','"')
did not work. No error message.
Thank you. :)
...
I understand why Python requires explicit self qualifier when referring to instance attributes.
But I often forget it, since I didn't need it in C++.
The bug I introduce this way is sometimes extremely hard to catch; e.g., suppose I write
if x is not None:
f()
instead of
if self.x is not None:
f()
Suppose attribute x is u...