목록의 요소를 검사 할 수 있습니까? "test01.txt"와 같은 단어가 있으면 공백으로 바꿉니 까?목록의 요소를 공백으로 바꿉니다.
test01.txt : 코드에서
to
her
too
a
for
: "인쇄 SSX"에서
with open('C:/test01.txt') as words:
ws = words.read().splitlines()
with open('C:/test02.txt') as file_modify4:
for x in file_modify4:
sx = map(str.strip, x.split("\t"))
ssx = sx[0].split(" ")
print ssx
결과 :
['wow']
['listens', 'to', 'her', 'music']
['too', 'good']
['a', 'film', 'for', 'stunt', 'scheduling', 'i', 'think']
['really', 'enjoyed']
어떻게 SSX의 요소를 대체?
['wow']
['listens', ' ', ' ', 'music']
[' ', 'good']
[' ', 'film', ' ', 'stunt', 'scheduling', 'i', 'think']
['really', 'enjoyed']
어떤 제안 :
는 결과를 예상?
는 초 나를 이길 : 모두 함께 넣어 그래서
, D –