Steven D'Aprano schreef op de 2e dag van de slachtmaand van het jaar 2012:
> On Fri, 02 Nov 2012 23:22:53 +0100, Peter Kleiweg wrote:
>
> > In Python 3.1 and 3.2
> >
> > At start-up, the value of sys.stdin.newlines is None, which means,
> > universal newl
abled.
Why is this?
--
Peter Kleiweg
http://pkleiweg.home.xs4all.nl/
--
http://mail.python.org/mailman/listinfo/python-list
Dave Angel schreef op de 7e dag van de lentemaand van het jaar 2012:
> On 03/07/2012 02:41 PM, Peter Kleiweg wrote:
> > I want to write out some binary data to stdout in Python3. I
> > thought the way to do this was to call detach on sys.stdout. But
> > apparently, you can
-up, type(sys.stdout) is
, and it's also after using the
second method.
After using the first method, type(sys.stdout) is changed to
.
Should I always use the second method?
--
Peter Kleiweg
http://pkleiweg.home.xs4all.nl/
--
http://mail.python.org/mailman/listinfo/python-list
cript gives the following error:
Exception ValueError: 'underlying buffer has been detached' in
Same in Python 3.1.4 and Python 3.2.2
So, what do I do if I want to send binary data to stdout?
--
Peter Kleiweg
http://pkleiweg.home.xs4all.nl/
--
http://mail.python.org/mailman/listinfo/python-list
Aahz schreef op de 12e dag van de oogstmaand van het jaar 2010:
> In article ,
> Peter Kleiweg wrote:
> >Hartmut Goebel schreef op de 12e dag van de oogstmaand van het jaar 2010:
> >
> >> Here is an example for how to use the high-level interface of
> >> `py
"-f", sys.argv[2]
> ]
>
> ghostscript.Ghostscript(*args)
How is this different from os.system(' '.join(args)) ?
--
Peter Kleiweg L:NL,af,da,de,en,ia,nds,no,sv,(fr,it) S:NL,de,en,(da,ia)
info: http://www.let.rug.nl/kleiweg/ls.html
--
http://mail.python.org/mailman/listinfo/python-list
Martin v. Loewis schreef op de 27e dag van de zomermaand van het jaar 2010:
> Am 25.06.2010 17:13, schrieb Peter Kleiweg:
> > How do I set the string encoding for os.system to anything other then UTF-8?
>
> You shouldn't have to set it, as it should use your locale's
but besides making
> it easier for other people to switch, I can't see *any* benefit.
> That's bound to frustrate people.
The latest NumPy is 1.4.1, and it does not install with Python 3.1.1
--
Peter Kleiweg L:NL,af,da,de,en,ia,nds,no,sv,(fr,it) S:NL,de,en,(da,ia)
info: http:/
Stephen Hansen schreef op de 26e dag van de zomermaand van het jaar 2010:
> On 6/26/10 11:55 AM, Peter Kleiweg wrote:
>
> > I have been using Python 3 for quite some time now, and this
> [snip]
>
> I'm not advocating using Python 3 or that it doesn't have plenty
7;[:1]
False
Why
In the end it may be all better, but at the moment, still a lot
of work has to be done to fix the standard library. And then
there's all those packages out there, that have to be ported...
I still can't use numpy in Python 3.
--
Peter Kleiweg L:NL,af,da,de,en,ia,nds,no,sv,(fr,it) S:NL,de,en,(da,ia)
info: http://www.let.rug.nl/kleiweg/ls.html
--
http://mail.python.org/mailman/listinfo/python-list
How do I set the string encoding for os.system to anything other then UTF-8?
(peter) ~ echo $LANG
nl...@euro
(peter) ~ python3
Python 3.1.1 (r311:74480, Oct 2 2009, 11:50:52)
>>> '\N{EURO SIGN}'
'€'
>>> import os
>>> os.system('echo \N{
load)
File "/my/opt/Python-3/lib/python3.1/email/charset.py", line 380, in
body_encode
return email.base64mime.body_encode(string)
File "/my/opt/Python-3/lib/python3.1/email/base64mime.py", line 94, in
body_encode
enc = b2a_base64(s[i:i + max_unencoded]).decode("ascii")
TypeError: must be bytes or buffer, not str
>>>
--
Peter Kleiweg
--
http://mail.python.org/mailman/listinfo/python-list
>>> import re
>>> s = u'a b\u00A0c d'
>>> s.split()
[u'a', u'b', u'c', u'd']
>>> re.findall(r'\S+', s)
[u'a', u'b\xa0c', u'd']
This isn't documented either:
>>> s = ' b c '
>>> s.split()
['b', 'c']
>>> s.split(' ')
['', 'b', 'c', '']
--
Peter
Carsten Haese schreef op de 22e dag van de hooimaand van het jaar 2007:
> On Sun, 2007-07-22 at 17:44 +0200, Peter Kleiweg wrote:
> > > It's a feature. See help(str.split): "If sep is not specified or is
> > > None, any whitespace string is a separator.&q
Carsten Haese schreef op de 22e dag van de hooimaand van het jaar 2007:
> On Sun, 2007-07-22 at 17:15 +0200, Peter Kleiweg wrote:
> > Is this a bug or a feature?
> >
> >
> > Python 2.4.4 (#1, Oct 19 2006, 11:55:22)
> > [GCC 2.95.3 20010315 (SuSE)] on l
xa0d', 'e']
>>> a = a.decode('latin-1')
>>> a
u'a b c\xa0d e'
>>> a.split()
[u'a', u'b', u'c', u'd', u'e']
--
Peter Kleiweg L:NL,af,da,de,en,ia,nds,no,sv,(fr,it) S:NL,de,en,(da,ia)
info: http://www.let.rug.nl/kleiweg/ls.html
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh schreef op de 16e dag van de slachtmaand van het jaar 2005:
> Peter Kleiweg wrote:
>
> > I want the program to behave identical if the 'close' button of
> > the application window is clicked. I tried the code below,
> > using a class derived
else:
if tkMessageBox.askyesno(_('Quit'), _('Project is not saved. Ignore
changes and quit?')):
root.quit()
class myTk(Tk):
def destroy(self):
quit()
root = myTk()
--
Peter Kleiweg L:NL,af,da,de,en,ia,nds,no,sv,(fr,it) S:NL,de,en,(da,ia)
info: htt
Fredrik Lundh schreef op de 16e dag van de slachtmaand van het jaar 2005:
> Peter Kleiweg wrote:
>
> > This does not what I want it to do:
> >
> >>>> a = [[]] * 6
> >>>> a[3].append('X')
> >>>> a
> &
range(6)]
>>> b[3].append('X')
>>> b
[[], [], [], ['X'], [], []]
The first is clear and wrong. The second is hairy and right.
Is there a way to do it clear and right?
--
Peter Kleiweg L:NL,af,da,de,en,ia,nds,no,sv,(fr,it) S:NL,de,en,(da,ia)
info: http://www.let.rug.nl/~kleiweg/ls.html
--
http://mail.python.org/mailman/listinfo/python-list
00
> py>
>
> You can use time.time() to get the UTC time, then add the offset.
The offset is for this moment, not for the date and time of the
string parsed.
--
Peter Kleiweg L:NL,af,da,de,en,ia,nds,no,sv,(fr,it) S:NL,de,en,(da,ia)
info: http://www.let.rug.nl/~kleiweg/ls.html
--
http://mail.python.org/mailman/listinfo/python-list
MT'
seconds = time.mktime(time.strptime(s, '%a, %d %b %Y %H:%M:%S %Z'))
However, I also need conversions to localtime. Setting TZ to UTC
before importing the time module won't let me do this. Changing
TZ after importing time has no effect.
--
Peter Kleiweg L:NL,af,da,de,en,
23 matches
Mail list logo