Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #5933
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Matthias Urlichs <matthias@urlichs.de> |
| Newsgroups | de.comp.lang.python |
| Subject | [Python-de] raw stdio unter Windows? |
| Date | Fri, 16 Dec 2022 19:16:33 +0100 |
| Lines | 58 |
| Message-ID | <78774179-7e09-93ba-842e-d1065e68fa9a@urlichs.de> (permalink) |
| Mime-Version | 1.0 |
| Content-Type | multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------98uJEs0iUDqo4sEKG9ZwVMdI" |
| X-Trace | news.uni-berlin.de hbhDaKtc/493T8/+yUlQ0QYVaYNwsaUWOQ02Qe6IK2uA== |
| Authentication-Results | mail.python.org; dkim=pass reason="4096-bit key; unprotected key" header.d=urlichs.de header.i=@urlichs.de header.b=j3GGJgTX; dkim-adsp=pass; dkim-atps=neutral |
| DKIM-Signature | v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=urlichs.de; s=20160512; h=Content-Type:Subject:From:To:MIME-Version:Date:Message-ID: Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=mE04dggLvn1wiMzyuTdTJ+vyGVmcin09YV6FTmXa0q0=; b=j3GGJgTXy1qzxyyppnmJgFi+j0 +WMQhXg2ceJjYv6iC7aALZQ/ejFMTpdWKAyAY1Svquel1Op0B8Bq7jJ5OAOqXuiscf7bz27h/cXi4 TO03POtnJE8Wabua8hg2pR6m7jDRqM6BmXQlclnaPq7loheAWRPrIpjc+W5sUgtbNKUd7JfriIIO1 g34ckRgdaSoNpEjII9jTd2PfEEq6UF7SpWpNbSXgSos2gXRff50mbOxePOm1LBubXo3KSJOFqyM86 68MYTTtauWN8/KsV9wjo5Ff38y+aDW47gOglGu6O/0Rq+CRc4CNVHGVM5RwyFsxq7JuBhJkVKKnzX hn9Ia/xMuxsSzP54O1cKcuWlrwClfymyGolNAgEfk5ockDmUk77GHojbmXshZkQBNDCBWIsiz2W9v bPJw7gXXjoDZbyNHwKVh7RES1O8uAVSen//rcByp6TdwW+Ky0GXCviXGnjOAdwqS86dI0a7wnkcwG NK1SYyF7MDJMZvers2sJNEYHAbM+udOS2h2XdYW3gWM7D/ZBJc3jX8j1tCjiVkUH/T0b+LIh9JDjM vY82dmOGW3dLI/uASIwLw7ljeV9vKP4L9dl3wnHCTA54V50sxt2VbkmeC56midib5PCvlnaqp+kAS bWPZs85ZIeI02e5u6/KqbiaMnBr5MFHlHWcLyf/8Y=; |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 |
| Content-Language | en-US |
| X-Smurf-Spam-Score | -1.9 (-) |
| Message-ID-Hash | IG57IRY5XDP6NMLOKVYWBBY6UP2GC7LS |
| X-Message-ID-Hash | IG57IRY5XDP6NMLOKVYWBBY6UP2GC7LS |
| X-MailFrom | matthias@urlichs.de |
| X-Mailman-Rule-Misses | dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-python-de.python.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header |
| X-Content-Filtered-By | Mailman/MimeDel 3.3.8b1 |
| X-Mailman-Version | 3.3.8b1 |
| Precedence | list |
| List-Id | Die Deutsche Python Mailingliste <python-de.python.org> |
| Archived-At | <https://mail.python.org/archives/list/python-de@python.org/message/IG57IRY5XDP6NMLOKVYWBBY6UP2GC7LS/> |
| List-Archive | <https://mail.python.org/archives/list/python-de@python.org/> |
| List-Help | <mailto:python-de-request@python.org?subject=help> |
| List-Owner | <mailto:python-de-owner@python.org> |
| List-Post | <mailto:python-de@python.org> |
| List-Subscribe | <mailto:python-de-join@python.org> |
| List-Unsubscribe | <mailto:python-de-leave@python.org> |
| Xref | csiph.com de.comp.lang.python:5933 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Kurze Frage, weil ich keine Windowskiste habe und schon gar nicht mit Python drauf: Funktioniert dieser Code (und produziert eine 4 Bytes lange Datei, wenn man die Ausgabe in eine solche umleitet) unter Windows? import sys from contextlib import contextmanager @contextmanager def maybe_open(filename, mode): if filename is None: if mode[-1] == "b": yield sys.stdin.buffer.raw if mode[0] == "r" else sys.stdout.buffer.raw else: yield sys.stdin if mode == "r" else sys.stdout else: with open(filename, mode) as f: yield f with maybe_open(None,"wb") as f: f.write(b"ABC\x0A") -- -- mit freundlichen Grüßen -- -- Matthias Urlichs
Back to de.comp.lang.python | Previous | Next — Next in thread | Find similar
[Python-de] raw stdio unter Windows? Matthias Urlichs <matthias@urlichs.de> - 2022-12-16 19:16 +0100 [Python-de] Re: raw stdio unter Windows? Christopher Arndt <chris@chrisarndt.de> - 2022-12-16 20:49 +0100
csiph-web