Hello all. I'm trying to create a custom TCP stack using Python 2.6.5 on Windows 7 to serve valid http page requests on port 80 locally. But, I've run into a snag with what seems like Windows 7 tightened up security. This code worked on Vista.
Here's my sample code:
import SocketServer
import struct
class MyTCPHandler(SocketServer....
I open a website with urlopen. I then put the website sourcecode into a variable like so
source = website.read()
When I just print the source it comes out formatted correctly, however when I try to iterate through each line each character is it's own line.
for example
when I just print it looks like this
<HTML> title</html>
When ...
I have a large string with brackets and commas and such. I want to strip all those characters but keep the spacing. How can I do this. As of now I am using
strippedList = re.sub(r'\W+', '', origList)
...
I'd like to create a small script to that basically does this: run program1.exe --> kill program1.exe after n seconds --> run program1.exe again.
I know some basic Python and would read up on this, but I'm in a bit of a hurry and just need this to get done asap.
If someone has a script/idea or could help my out with just the syntax I ...
Skype has an inbuilt function where iTunes playback is paused and resumed automatically when a call comes in. It would be nice to have something similar for Spotify. Both provide a python API so this would seem the obvious route to go down.
...
I have a string that looks something like this:
[["Name1","ID1","DDY1", "CALL1", "WHEN1"], ["Name2","ID2","DDY2", "CALL2", "WHEN2"],...];
This string was taken from a website. There can be any amount of groupings. How could I parse this string and print just the Name variables of each grouping?
...
As per the title, is it possible to change the first day of the week (Monday instead of Sunday)?
...
PEP 8 says:
Python accepts the control-L (i.e. ^L)
form feed character as whitespace;
Many tools treat these characters as
page separators, so you may use them
to separate pages of related sections
of your file
This look like a great idea for me, but in the text editor I use(kate) "control+L" is for save all files. Someon...
Hello!
Basically I have a script in Python that grabs the text from an open window using getWindowText() and outputs it to the screen. The python loops so as the text in the window changes, it outputs the changes, so the output of the python will always be up to date with the window text.
I'm trying to access this text in my Java progra...
I am attempting to profile a long running python script. The script does some spatial analysis on raster GIS data set using the gdal module. The script currently uses three files, the main script which loops over the raster pixels called find_pixel_pairs.py, a simple cache in lrucache.py and some misc classes in utils.py. I have profi...
hi,
i am using cairoplot, to make graphs, however the file from where i am reading the data is growing huge and its taking a long time to process the graph
is there any real-time way to produce cairo graph, or at least store the previous readings..like rrd.
-krisdigitx
...
for example the following:
str(u'לשום')
will throw an error.
how can i prevent these?
...
Im trying to output some data from my google app engine datastore to xml so that a flash file can read it,
The problem is when using CDATA tags the outputted xml contains < instead of <
e.g
<name><![CDATA][name]]></name>
here is my python which outputs the xml:
doc = Document()
feed = doc.createElement("feed")
...
Hello,
I want to keep last.fm's user recent music tracks list to postgresql database table using pylast interface.But when I tried to insert values to the table it shows errors.Code example:
import pylast
import psycopg2
import re
from md5 import md5
import sys
import codecs
import psycopg2.extensions
psycopg2.extensions.register_type...
In my app users can upload files for other users.
To make the uploaded files accesible only for the addresse I need some kind of static files authentication system.
My idea, is to create the apache hosted directory for each user and to limit access to this derectory using .htaccess.
This means that each time new django user is created,...
In python how to sum up the following time
0:00:00
0:00:15
9:30:56
Thanks..
...
Hi,
I have some strings that I want to delete some unwanted characters from them.
For example: Adam'sApple ----> AdamsApple.(case insensitive)
Can someone help me, I need the fastest way to do it, cause I have a couple of millions of records that have to be polished.
Thanks
...
Hello,
Is there any way to handle connection errors with simplexmlrpcserver module? I want to catch any errors within my xmlrpc server to handle them in my own way instead of printing the traceback to stdout.
...
As per the below link porting python packages from 2 to 3 would be easy when distribute is used.
Is tat true?
anyone tried before?
karnol
...
I'm using Python's unittest module for unit testing.
I'd like to be able to report informational messages as part of the unit test output—other than pass/fail status. Specifically in my case, I want to report whether the module under test is using the pure Python implementation or the C extension.
Is there a mechanism in unittest to ou...