업데이트 할 WSUS 그룹을 검색하는 동안 두 문자열을 비교하려고합니다. 그러나 시각적으로 같고 동일한 유형인데도 내 비교가 실패합니다. 이것이 IronPython이기 때문에 나는 코모도에서 사용할 수있는 디버거를 가지고 있지 않다. (누구든지 IP에 대해 알고있다.)IronPython에서 문자열 비교
어쨌든 누군가 내가 뭘 잘못하고 있는지 알아낼 수 있을까?
#----------------------------------------------------------------------
# Search for a matching patch group, and approve them.
#----------------------------------------------------------------------
def WSUSApprove(apprvGrpName):
clr.AddReference('Microsoft.UpdateServices.Administration')
import Microsoft.UpdateServices.Administration
wsus = Microsoft.UpdateServices.Administration.AdminProxy.GetUpdateServer('wsus01',False,8530)
parentGroupCollection = wsus.GetComputerTargetGroups()
for computerTarget in parentGroupCollection:
if computerTarget.Name.ToString() == 'Servers':
parent = computerTarget
childGroupCollection = parent.GetChildTargetGroups()
for computerTarget in childGroupCollection:
print type(computerTarget.Name.ToString())
print type(apprvGrpName)
if apprvGrpName == computerTarget.Name.ToString():
print 'success', computerTarget.Name.ToString()
else:
print 'a', computerTarget.Name.ToString()
print 'b', apprvGrpName
#--output that should be equal--#
<type 'str'>
<type 'str'>
a 3 Tuesday
b 3 Tuesday
'그중 하나에 \ n이 표시됩니다. 당신의 도움을 주셔서 감사합니다. 이봐. – EdgeCase
나는 그것을 대답으로 옮길 것이다. 귀하의 질문에 대한 답변을 수락하는 것을 기억하십시오 (귀하는 처음 두 사람에게 한 것이 아닙니다). – agf