i have a dictionary when i pass it over simplejson.dumps(dict) the json output has put some sort of encoding on a string url?
"link": "http:\/\/www.mydomain.com"
How can i stop this?
Im using app engine simplejson.
...
I'm looking for the most efficient way to add an element to a comma-separated string while maintaining alphabetical order for the words:
For example:
string = 'Apples, Bananas, Grapes, Oranges'
subtraction = 'Bananas'
result = 'Apples, Grapes, Oranges'
Also, a way to do this but while maintaining IDs:
string = '1:Apples, 4:Bananas, ...
Hi All,
I have a config file FOO in /etc/sysconfig/. This Linux file is very similar to INI-File, but without a section declaration.
In order to retrieve a value from this file, I used to write a shell script like:
source /etc/sysconfig/FOO
echo $MY_VALUE
Now I want to do the same thing in python. I tried to use ConfigParser, but Co...
i am trying to convert bitmap images into a base64 string before inserting it into database as binary blobs. The base64 string needs to be encoded in such a way that their is a new line character after every 76 characters. what is the best pythonic way of doing this ?
...
Hi All,
My basic question is how to prevent spam and dirty words in a comment post system under python (django).
I have a collection of phrases (approximately 3000 phrases) to be blocked.
What I want to do is like this:
If I found a comment which has a dirty-word when user clicks the post button, then the web should popup a warnin...
I just finished my second year as a university CS student, so my "real-world" knowledge is lacking. I learned Java my first year, continued with Java and picked up C and simple Bash
scripting my second. This summer I'm trying to learn Perl (God help me). I've dabbled with Python a bit in the past.
My question is, now that we have ve...
I know that "bash -x script.sh" will execute script printing each line before actual execution.
How to make perl and python interpreters do the same?
...
i have the following code to convert bunch of bitmap images in a database(binary blob format) to base64 string and store it back into the database.
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.orm import mapper
from sqlalchemy.orm import sessionmaker
import csv
import random
import base64
db = create_engine('my...
Hi,
I'm trying to read a file byte by byte, but I'm not sure how to do that. I'm trying to do it like that:
file = open(filename, 'rb')
while 1:
byte = file.read(8)
# Do something...
So does that make the variable byte to contain 8 next bits at the beginning of every loop? It doesn't matter what those bytes really are. The only...
How to truncate the string to 75 characters only in Python?
This is how it was done in JavaScript:
var data="saddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddsaddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddsadddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...
I tried os.system, os.spwanl, etc.. but it doesn't work well
I need to execute some background process from django application.
...
I have this:
response = urllib2.urlopen(url)
html = response.read()
begin = html.find('<title>')
end = html.find('</title>',begin)
title = html[begin+len('<title>'):end].strip()
if the url = http://www.google.com then the title have no problem as "Google",
but if the url = "http://www.britishcouncil.org/learning-english-gatewa...
I have a a QWidgetAction which holds a QWidget composed of a QLineEdit and a QPushButton. Once the user press the button the QWidgetAction call the trigger slot.
Now I have a QMenu which I activate with exec. The problem is that even though trigger is called (I've connected it to a print function as well to check) the menu won't close.
...
Hi,
I'm using a wxWizard control. I know about the on EVT_WIZARD_PAGE_CHANGED and the EVT_WIZARD_PAGE_CHANGING events but could anyone please tell me how to trigger an event when a particular wizard page loads?
Thanks.
...
Hello,
I am sending commands over suds. I have errors occuring in the command line but I do not know which exceptions to place in as I am not sure which ones to use for SUDS.
try:
result = self.client.service.GetStreamUri(self.stream, self.token)
print result
assert True
except suds.WebFault, e:
...
I wrote a very short program that parses a "program" using python and converts it to assembler, allowing me to compile my little proramming language to an executable.
You can read my blog for more information here http://spiceycurry.blogspot.com/2010/05/simple-compilable-programming-language.html
my question is... Where can I find m...
I'm curious if there's a simpler way to remove a particular parameter from a url. What I came up with is the following. This seems a bit verbose. Libraries to use or a more pythonic version appreciated.
parsed = urlparse(url)
if parsed.query != "":
params = dict([s.split("=") for s in parsed.query.split("&")])
if params.get("pag...
I wrote a program to compile a simple text program to a compiled executable... Is it possible that I can load an executable to memory an some how point a pc counter to the memory space at will?
Here is what I made that I would like to store the programs to memory for execution on demand... Kind of wanting to make a little web language l...
hello , i am new to python , and I want to extract the data from this format
FBpp0143497 5 151 5 157 PF00339.22 Arrestin_N Domain 1 135 149 83.4 1.1e-23 1 CL0135
FBpp0143497 183 323 183 324 PF02752.15 Arrestin_C Domain 1 137 138 58.5 6e-16 1 CL0135
FBpp0131987 60 280 51 280 PF00089.19 Trypsin Domain 14 219 219 127.7 3.7e-37 1 CL0124
t...
I am learning Python (I have a C/C++ background).
I need to write something practical in Python though, whilst learning. I have the following pseudocode (my first attempt at writing a Python script, since reading about Python yesterday). Hopefully, the snippet details the logic of what I want to do. BTW I am using python 2.6 on Ubuntu K...