On May 29, 11:30 pm, Nikhil [EMAIL PROTECTED] wrote:
or a string iterable ? How can I do that. I have lots of '\r\n'
characters in the string which I think can be easier if it were made
into a list and I can easily see if the required value (its a numeral)
is present in it or not after some
First make sure your DB encoding is UTF-8 not the latin1
The error I keep having is something like this:
ERREUR: Séquence d'octets invalide pour le codage «UTF8» : 0xe02063
then try this:
def smart_str(s, encoding='utf-8', errors='strict'):
Returns a bytestring version of 's',
string = Butler's 15\ TV
s = my string goes here %s % string
Couldn't find anything wrong in
string = Butler's 15\ TV
s = my string goes here %s % string
--
http://mail.python.org/mailman/listinfo/python-list
You could write a simple escape function.
def escape(html):
Return the given TEXT with ampersands, quotes and carets
encoded.
return html.replace('', 'amp;').replace('',
'lt;').replace('', 'gt;').replace('', 'quot;').replace(',
'#39;')
--
python has modules for forms and other things... and for it?
Check out httplib and urlib2, it might be useful for you.
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 2007-08-30 at 20:11 -0500, Lamonte Harris wrote:
Like in math where you put letters that represent numbers for place
holders to try to find the answer type complex numbers?
You shouldnt worry about it in python, its pretty large to handle all
your calc.
--
On Aug 31, 5:40 pm, Michele Simionato [EMAIL PROTECTED]
wrote:
I would like to upload a tab-separated file to a Google spreadsheet
from Python. Does anybody
have a recipe handy? TIA,
Michele Simionato
Probably its irrelevant to python. Use should see Google Spreadsheet
API and use it in
i would like to sort a list of lists. The list is first sorted on the
second item in the sub-lists (which I can do), then on the third item
(which I can't).
Write a comparator instead of dirty hacks
mylistoflist.sort(mycomparator)
def mycomparator(a, b):
#do
--
Taking advantage of stable sorting is totally not a hack. The OP just tried
the two sorting steps in the wrong order.
I didnt say not to use stable sorting, but write a generic function
and hacky code. It is always better to adopt a generic approach.
--
I'm just learning Python, and I have a question about os.path.join(dirpath,
name) and its use. Simply put, I haven't figured out how to use it.
First thing you have to remember while using python is everything is
an object. os.join.path concatenates one or more path for example
My question is how difficult is to set up a web server that can run
python easy ? should I try ZOPE or there is something better in mind ?
Just install Apache and run Python as CGI thats the best solution I
found for my apps. Thats the best and faster way to move python apps on
web.
--
Do you have an IBM s/370 running VM/CMS? VM was sort of an OS for
running multiple OSs, so it would be the restricted environment G
I'm having currently working on OS/2 and Linux platform, I've designed
a web based ide for python and i wish to restrict some commands and
user can only
!
Best!
iapain
--
http://mail.python.org/mailman/listinfo/python-list
. Use some tricks to encrypt the user path and do lots of replacement
on user code and o/p.
or something else?
Best!
iapain
--
http://mail.python.org/mailman/listinfo/python-list
unless you're willing to build a restricted runtime that runs on top of the
core inter-
preter, you should assume that anyone writing a Python script that's executed
by
your program has access to everything that your Python process has access
to...
I think using replacements I can ban
of Sun's resources and
talent, security holes are sometimes found even in Java.
Does that mean there is no way to implement restricted enviorment?
Best!
iapain
--
http://mail.python.org/mailman/listinfo/python-list
where I'm not interested in the output, I only want to make sure that the
command was executed OK. How should I invoke this (in a Unix/linux
environment)?
Remember few things about executing program within python
1. Create a subprocess or child process and execute it.
2. You should use Timeout
The most knowledgeable people have effectively given up, in
regard to Python.
I guess now I am up with only one option, i.e hope that user input code
wont be evil to the system. **which is rarely possible**
--
http://mail.python.org/mailman/listinfo/python-list
Brett Cannon is currently trying to come up with a comprehensive spec
and implementation of a sandboxed Python interpreter, for use in
Mozilla as a JavaScript replacement. (look in the python-dev archives
for more)
I'm not sure he is working or not, latest i read was he purposed new
') # If this PATH is defined then use can access
files else he cant .. is there is any way?
Regards!
iapain
--
http://mail.python.org/mailman/listinfo/python-list
Tim Chase wrote:
If you're prepared for the massive breakage that will ensue, you can
chmod go-rwx /usr/lib/python2.3/os.*
No, I cant change permission or delete the module, the best would be
something to detect 'import os' in user code .. but If i go with chroot
jail approch then
Use os.system and if you wanna get rid of console window use subprocess
as gary said, you could have better options like killing proc if it
hang/stuck using win32api (if you are using windows) else process
timeout.
ret = os.system('sample.exe') # ret will have return code and os.system
execute
Thanks Tim, Yeah win32api is working normally.
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I am trying to build and infinite loop handler in python 2.4 on windows
platform. The problem is that i want to create a process and forcely
kill/timeout after 2 sec to handle infinite loop in a gcc complied exe
on cygwin. something like below
os.system(mycpp.exe) # this exe is compiled
Hi,
if you want to import module dynamically, you can use __import__ ..
always remember modules are objects ..
mStr=sys
mod=__import__(mStr)
# Now u can use mod.version .. but cant specify the attribute using
other variable, like u did
mod.version
should read it
25 matches
Mail list logo