Hello bats,

on Fri, 20. Feb 2004 at 16:37:44 +0100 Carsten Thönges wrote:

>> Is it possible to convert %20 back to space or any other special chars
>> to its "real value"?
C> Python.

C> --8<---------------cut here---------------start------------->8---
C> %_tbvar="Peter%%20Palmreuther"

C> %Py("
C> import urllib

C> quoted_string = tb.macro(r'%%_tbvar')
C> print urllib.unquote(quoted_string)
C> ")
C> --8<---------------cut here---------------end--------------->8---

Installed Python now, but having a last issue.. the %Py macro seems to
make up a new line.

I have this:
----->8--------------------------------------------------------
%SETPATTREGEXP="(?:msgid:|Message-ID:\s+)?(?:<?)([EMAIL 
PROTECTED])(?:(?:\?\w)|>|$)(?:.*from=(.*?)&)?"%-
%REGEXPBLINDMATCH="%ClipBoard"%-
%IF:%SUBPATT="2"<>'':#%-
%Py("%-
import urllib
quoted_string = tb.macro(r'%%SUBPATT=2')
print urllib.unquote(quoted_string)
")%-
%__%IF:'%_lang'='deutsch':" schrieb in":"%-
%__ wrote in"# %-
<mid:%SUBPATT="1";>
----->8--------------------------------------------------------

and btw: how would I give a TB macro the result of urllib.unquote?
As Python should be straight forward I tried
tb.macro(r'%%_author') = urllib.unquote(quoted_string)
but no luck..


-- 
shinE!
http://www.thequod.de ICQ#152282665
GnuPG/PGP key: http://thequod.de/danielhahler.asc

Using The Bat! v2.04.4 on Windows XP 5.1 Build 2600 Service Pack 1
with POPFile 0.20.1 and avast Jan2004 (4.1.342)


________________________________________________________

http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to