with open('C:\Users\craig\Downloads\folder\test.txt', 'r') as myfile:
test = myfile.read().replace('', '')
있는 test.txt은 다음과 같습니다파일 seperation에
hugh:ted
mark:mike
ethan:jay
가 어떻게 파이썬이 제거 얻을 것이다 : 모든 것이지나? 예를 들어, 대체 부품에 수동으로 쓰지 않고도 ted, : mike, : jay를 어떻게 제거 할 수 있습니까?
나는'line.split (':') [0]'을 선호한다. – Matthias