Autor Beitrag
Teekeks
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 211
Erhaltene Danke: 23



BeitragVerfasst: Fr 17.08.12 14:49 
Hallo!

leicht gekürzt habe ich diesen Python-Code:
ausblenden Quelltext
1:
2:
3:
4:
actline = sys.stdin.readline()
while actline != "":
 #...
 actline = sys.stdin.readline()

Er geht nie aus der Schleife...

Woran liegt das?

Ich gebe zu, totaler Anfänger in Python zu sein, vl habe ich ja auch nur irgend etwas in der Funktionsweise missverstanden.

Grüße, Teekeks


Moderiert von user profile iconNarses: Topic aus Sonstiges (Delphi) verschoben am Fr 17.08.2012 um 21:18
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Fr 17.08.12 17:29 
docs.python.org/libr...l#bltin-file-objects hat folgendes geschrieben:
Read one entire line from the file. A trailing newline character is kept in the string [...]
:zwinker: ...

Darunter findest du aber direkt bessere Alternativen: readlines oder einfach for line in file.

_________________
>λ=