Hi,
From
http://www.pyzine.com/Issue008/Section_Articles/article_Encodings.html#guessing-the-encoding:
> The way to access the information about the "normal" encoding used on the
> current computer is through the locale module. Before using locale to
> retrieve the information you want, you need
Hi,
I am writing unicode stings into a special text file that requires to
have non-ascii characters as as octal-escaped UTF-8 codes.
For example, the letter "Í" (latin capital I with acute, code point 205)
would come out as "\303\215".
I will also have to read back from the file later on and con
Michael Goerz wrote:
> Hi,
>
> I am writing unicode stings into a special text file that requires to
> have non-ascii characters as as octal-escaped UTF-8 codes.
>
> For example, the letter "Í" (latin capital I with acute, code point 205)
> would come out as "
MonkeeSage wrote:
> Looks like escape() can be a bit simpler...
>
> def escape(s):
> result = []
> for char in s:
> result.append("\%o" % ord(char))
> return ''.join(result)
>
> Regards,
> Jordan
Very neat! Thanks a lot...
Michael
--
http://mail.python.org/mailman/listinfo/python-list
MonkeeSage wrote:
> On Dec 3, 1:31 am, MonkeeSage <[EMAIL PROTECTED]> wrote:
>> On Dec 2, 11:46 pm, Michael Spencer <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>>> Michael Goerz wrote:
>>>> Hi,
>>>> I am writing unicode stings into a
Hi,
when I try to catch ctrl+c with
except KeyboardInterrupt:
pychecker tells me
Catching a non-Exception object (KeyboardInterrupt)
It works fine, but the message indicates that it's not completely clean.
How should I write the exception correctly?
Thanks,
Michael
--
http://mail.python.o
DiMar wrote, on 02/12/2008 09:54 PM:
> Hi all,
>
> I have this unicode string:
>
> string = u'Macworld » Jobs 1 - Twitter 0'
>
> and I want to replace the '»' (aka \xbb) char to '»'.
> I've tried 2 ways:
>
> 1.
string2 = string.replace('\\xbb','»')
> u'Macworld \xbb Jobs 1 - Twitter 0'
How
Hi,
I'm writing a command line program that watches a file, and recompiles
it when it changes. However, there should also be a possibility of doing
a complete clean restart (cleaning up temp files, compiling some
dependencies, etc.).
Since the program is in an infinite loop, there are limited
Hi,
I'm using subprocess.Popen() to run some background processes. However,
the program is also supposed to catch CTRL+C keyboard interrupts for
refreshs (i.e. a keyboard interrupt doesn't shut down the program).
But as it seems, a keyboard interrupt will automatically pass down to
the subproc
Hi,
I would like to raise an exception any time a subprocess tries to read
from STDIN:
latexprocess = subprocess.Popen( \
'pdflatex' + " " \
+ 'test' + " 2>&1", \
shell=True, \
cwd=os.getcwd(), \
env=os.environ, \
stdin=StdinCatcher() # any
Ian Clark wrote, on 02/27/2008 12:06 PM:
> On 2008-02-27, Michael Goerz <[EMAIL PROTECTED]> wrote:
>> I would like to raise an exception any time a subprocess tries to read
>> from STDIN:
>> latexprocess = subprocess.Popen( \
>> 'pdflatex
Gabriel Genellina wrote, on 02/27/2008 03:26 PM:
> En Wed, 27 Feb 2008 15:06:36 -0200, Ian Clark <[EMAIL PROTECTED]>
> escribi�:
>
>> On 2008-02-27, Michael Goerz <[EMAIL PROTECTED]> wrote:
>>> Hi,
>>>
>>> I would like to raise an except
Grant Edwards wrote, on 02/27/2008 04:34 PM:
> On 2008-02-27, Michael Goerz <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I would like to raise an exception any time a subprocess tries to read
>> from STDIN:
>>
>> latexprocess = subprocess.Popen( \
>&g
Hi,
I'm trying to print out text in color. As far as I know, curses is the
only way to do that (or not?). So, what I ultimately want is a curses
terminal that behaves as closely as possible as a normal terminal, i.e.
it breaks lines and scrolls automatically, so that I can implement a
function
Miki wrote, on 03/03/2008 11:14 PM:
> Hello Michael,
>
>> I'm trying to print out text in color. As far as I know, curses is the
>> only way to do that (or not?).
> On unix, every XTerm compatible terminal will be able to display color
> using escape sequence.
> (Like the one you see in the output
Thynnus wrote, on 03/04/2008 08:48 AM:
> On 3/3/2008 9:57 PM, Michael Goerz wrote:
>> Hi,
>>
>> I'm trying to print out text in color. As far as I know, curses is the
>> only way to do that (or not?). So, what I ultimately want is a curses
>> terminal th
Michael Goerz wrote, on 03/04/2008 12:05 PM:
> Thynnus wrote, on 03/04/2008 08:48 AM:
>> On 3/3/2008 9:57 PM, Michael Goerz wrote:
>>> Hi,
>>>
>>> I'm trying to print out text in color. As far as I know, curses is
>>> the only way to do that (or
Hi,
I'm trying to print some variable through a pager (i.e. 'less') on a
linux system. My attempt was this:
== snip here ==
import subprocess
def put_through_pager(displaystring):
less_pipe = subprocess.Popen(\
'less', shell=True, \
stdin
Michael Goerz wrote, on 03/20/2008 04:43 PM:
> Hi,
>
> I'm trying to print some variable through a pager (i.e. 'less') on a
> linux system. My attempt was this:
>
>
> == snip here ==
> import subprocess
>
> def put_through_pager(displ
19 matches
Mail list logo