예 DXP에서 이것은 쉼표로 구분 된 값이있는 문자열입니다.
는 파이썬 코드에서이 작업을 수행하려면 다음 값을 반복 할 필요가있을 때
나중에
my_list = ['a', 'b', 'c']
delimiter = ","
Document.Properties["MyProp"] = delimiter.join(my_list)
print Document.Property("MyProp")
>>> 'a,b,c'
는 쉽게 목록으로 다시 변환 할 수 있습니다
my_prop = Document.Properties["MyProp"]
delimiter = ","
my_list = my_prop.split()
print my_list
>>> ['a', 'b', 'c']
최종주의 사항 : 문자열에 정수 나 문자열이 포함되어 있다면 파이썬이 타입에 대해 까다로울 수 있기 때문에 약간 다른 방식으로 연결해야합니다 :
my_list = [1, 2, 3]
delimiter = ","
Document.Properties["MyProp"] = delimiter.join(str(i) for i in my_list)
print Document.Property("MyProp")
>>> '1, 2, 3'
당신이
int()
와 정수 목록으로 변환 할 수 있습니다
:
my_prop = Document.Properties["MyProp"]
delimiter = ","
my_list = [int(i) for i in my_prop.split()]
print my_list
>>> [1, 2, 3]
좋아 그 정보를 주셔서 감사합니다. 나는 시험 할 것이고, 그것이 어떻게되는지 당신에게 알릴 것이다. –