Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > de.comp.lang.python > #5557

Re: [Python-de] Programming-Guidelines

From Hermann Riemann <nospam.ng@hermann-riemann.de>
Newsgroups de.comp.lang.python
Subject Re: [Python-de] Programming-Guidelines
Date 2019-10-24 14:38 +0200
Message-ID <h1dkabFb0soU1@mid.individual.net> (permalink)
References <831c8f4e-ab87-34bd-b7f2-4d2cf6eff38b@thomas-guettler.de> <mailman.138.1571904149.32318.python-de@python.org> <h1d7o7F8encU1@mid.individual.net> <8f590d9a-981e-70c1-94d8-49c6baac5faf@goebel-consult.de> <mailman.139.1571908487.32318.python-de@python.org>

Show all headers | View raw


Am 24.10.19 um 11:14 schrieb Hartmut Goebel:
> Am 24.10.19 um 11:04 schrieb Hermann Riemann:
>> Um in Python bei bei Suche mit grep -rp pyc Dateien
>> nicht zu durchsuchen, verwende ich symbolische links.
>> ( das Gleiche um die von *emacs erzeugte *~
>>    nicht auch zu durchsuchen.)

> Wenn Du deinen Dateien mit git verwaltetes, dann ist git grep Dein Freund.

Ich verwende kein git.

Kommandobefehle auf Konsole wie ls -l
oder etwas os.walk() unter Python3 (open ..)
gelegentlich auch über C Programme.

>> if not os.path.exists(ordnername):
>>     os.system("mkdir "+ordnername)
>> verwende ich des öfteren.

> Fröstel!

> 1) os.system sollte man nicht versenden, sondern subprocess.run()

In https://docs.python.org/3/library/subprocess.html steht
The run() function was added in Python 3.5;
Die meisten meiner Python Programme wurden unter Python <= 3.4
entwickelt. ( os.system() ist die Nachfolge von system() in C)

> 2) String.Konkatination ist brandgefährlich. wenn man einen externe
> Prozess startet.

Konkatination findet so oder über format statt;
und ist ausgeführt,
bevor system oder subprocess aufgerufen wird.

> 3) Du möchtest "os.makedirs()" verwenden.

Wenn ich Zeit habe, im Python3 Buch danach zu suchen.
( Python3 Ernesti Kaiser 5.Auflage 2017)


-- 
http://www.hermann-riemann.de

Back to de.comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

[Python-de] Programming-Guidelines Thomas Güttler <guettliml@thomas-guettler.de> - 2019-10-24 09:56 +0200
  Re: [Python-de] Programming-Guidelines Hermann Riemann <nospam.ng@hermann-riemann.de> - 2019-10-24 11:04 +0200
    Re: [Python-de] Programming-Guidelines Hartmut Goebel <h.goebel@goebel-consult.de> - 2019-10-24 11:14 +0200
      Re: [Python-de] Programming-Guidelines Hermann Riemann <nospam.ng@hermann-riemann.de> - 2019-10-24 14:38 +0200
        Re: [Python-de] Programming-Guidelines Hartmut Goebel <h.goebel@goebel-consult.de> - 2019-10-24 14:52 +0200
          Re: [Python-de] Programming-Guidelines Hermann Riemann <nospam.ng@hermann-riemann.de> - 2019-10-24 17:56 +0200
        Re: [Python-de] Programming-Guidelines Felix Schwarz <felix.schwarz@web.de> - 2019-10-25 10:46 +0200
        Re: [Python-de] Programming-Guidelines Erich Schnoor <eschnoor@multi-matrix.de> - 2019-10-25 12:34 +0200
        Re: [Python-de] Programming-Guidelines Erich Schnoor <eschnoor@multi-matrix.de> - 2019-10-25 12:27 +0200

csiph-web