Linux Kommando -- Output pro Zeile in Stringvariable
Verfasst: Montag 10. März 2008, 16:10
Hallo Forum,
ich habe ein Python2.5-Script in welchem ich mit subprocess.Popen ein Kommando auf der Shell absetze. Den Output hole ich mir so in eine Varaible:
retoralocks = myoralocks.stdout.read()
Der Output sieht so aus:
9099 0x19396e07:0x001af399 0:0 0 GRANTED (0x91160a48)
9099 0x19396e07:0x001af3a1 0:0 0 GRANTED (0xeb2ffbd8)
9099 0x19396e07:0x001af39b 0:0 0 GRANTED (0x926c4728)
9099 0x19396e07:0x001af39a 0:0 0 GRANTED (0xb0993d68)
9099 0x19396e07:0x001af397 0:0 0 GRANTED (0x7829bbd8)
9099 0x19396e07:0x001af396 0:0 0 GRANTED (0xed9f6bd8)
9087 0x17396d96:0x000911bb 0:0 0 GRANTED (0xaee564d0)
Nun möchte ich den Output Zeile pro Zeile bearbeiten.
"for line in retoralocks" funktioniert leider nicht so wie ich will, da er anscheinend jedes Zeichen als eigenen String interpretiert. Hat jemand einen guten Hinweis, wie man hier vorgehen könnte??
Grüße und Danke im Vorraus
Jochen
ich habe ein Python2.5-Script in welchem ich mit subprocess.Popen ein Kommando auf der Shell absetze. Den Output hole ich mir so in eine Varaible:
retoralocks = myoralocks.stdout.read()
Der Output sieht so aus:
9099 0x19396e07:0x001af399 0:0 0 GRANTED (0x91160a48)
9099 0x19396e07:0x001af3a1 0:0 0 GRANTED (0xeb2ffbd8)
9099 0x19396e07:0x001af39b 0:0 0 GRANTED (0x926c4728)
9099 0x19396e07:0x001af39a 0:0 0 GRANTED (0xb0993d68)
9099 0x19396e07:0x001af397 0:0 0 GRANTED (0x7829bbd8)
9099 0x19396e07:0x001af396 0:0 0 GRANTED (0xed9f6bd8)
9087 0x17396d96:0x000911bb 0:0 0 GRANTED (0xaee564d0)
Nun möchte ich den Output Zeile pro Zeile bearbeiten.
"for line in retoralocks" funktioniert leider nicht so wie ich will, da er anscheinend jedes Zeichen als eigenen String interpretiert. Hat jemand einen guten Hinweis, wie man hier vorgehen könnte??
Grüße und Danke im Vorraus
Jochen