You are not logged in.

  • Login

Dear visitor, welcome to Coder Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Thursday, July 21st 2011, 11:03am

Datei einlesen und weiterverarbeiten

Hallo,
ich möchte gerne ne Datei einlesen und die Variable weiter verarbeiten mein Code bisher:

Source code

1
2
3
4
5
6
7
8
9
10
11
elif 'windows' in platform.system().lower():
	source_file_list= 'dp_source.ini'
	excludes_list='dp_excludes.ini'
dp_excludes_file=open(excludes_list)
for excludeline in dp_excludes_file.readlines():
	if excludeline.lower().strip().startswith("excludes"):
excludes=re.split('^excludes\s=', excludeline.lower().strip())[1]	
dp_source_file = open(source_file_list)
for lines in dp_source_file.readlines():
if lines.lower().strip().startswith("sources"):
sources = re.split('^sources\s*=', lines.lower().strip())[1]


Die Sources werden übernommen Jedoch die Excludes ignoriert ich hoffe jemand kanns mir erklären was falsch ist
die sources.ini=
sources ='C:\'
die Excludes.ini=
excludes ='C:\Windows\'
natürlich bekommt excludes noch mehrere Ordner aber immer wenn ich die excludes aus Datei einlese hat meine Sicherung 0kb.
auch im Forum
http://www.python-forum.de konnte oder wollte mir niemand helfen.
Vielen dank schonmal

2

Monday, July 25th 2011, 3:53pm

Dein Code scheint bei den Tabs ziemlich verrutscht zu sein. Bitte rücke ihn korrekt ein, da man sonst bei Python nicht weiß, was zu welchem if-else gehört und wann es endet.

Und wenn du die exlcudes-Liste auslässt, dann läuft dein Programm korrekt ab? Also tritt der Fall des Totalversagens erst beim Einlesen von exclude auf, oder?

Similar threads

Social bookmarks