• programming language/python
[파이썬 개념] 데이터 분석 4- csv 파일에서 특정 문자 찾기(csv파일첨부)
oujin
2022. 7. 20. 16:22
728x90
약국명,지역,주소,개설일자,경도,위도
**입력하는 코드가 있는 파일과 같은 폴더에 위치해 있어야 합니다**
●
import csv
f = open('pharm_2019.csv', 'r', encoding='utf-8')
lines = csv.reader(f)
header = next(lines)
for line in lines:
if line[0]=='파랑새약국' and line[1]=='인천미추홀구':
print(line[0], line[1], line[2], sep='/')
f.close()
파랑새약국/인천미추홀구/인천광역시 미추홀구 장천로112번길 3 (숭의동)
출처: 예제 중심 파이썬 입문
궁금한 부분이 있으면 댓글 부탁드립니다^^
728x90