1.この場合は「A1234ABCDE120083.1」である「\」の後の最後の単語であるビルドロケーションからbuildidを取得します
2. buildidを取得した後、ファイルを開き、「Engr Label:Data_CRM_PL_177999」という行と一致させて、「Data_CRM_PL_177999」というラベル名を取得しようとしています。
3.最終出力は「Data_CRM_PL_177999」である必要があります
何らかの理由で、次の構文エラーが発生します。
import re
Buildlocation= '\\umor\locations455\INT\A1234ABCDE120083.1'
Labelgetbuildlabel(Buildlocation)
def getbuildlabel(BuildLocation):
buildid=BuildLocation.split('\')[-1]
Notes=os.path.join(BuildLocation,Buildid + '_notes.txt')
if os.path.exists(Notes):
try:
open(Notes)
except IOError as er:
pass
else:
for i in Notes.splitlines:
if i.find(Engr Label)
label=i.split(:)[-1]
print label//output should be Data_CRM_PL_177999
出力は次のようになります:-
Line looks like below in the file
Engr Label: Data_CRM_PL_177999
構文エラー
buildid=BuildLocation.split('\')[-1]
^
SyntaxError: EOL while scanning string literal