Notice
Recent Posts
Recent Comments
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- rember me
- guvnor
- maven
- COC
- JPA
- drools
- gwt
- java tip
- jquery
- spring security
- spring transaction
- spring jpa
- custom filter
- jstl
- jenkins
- GEventEvaluator
- CEP
- ibatis
- JBoss Seam
- Spring
- MySQL
- localdatetime
- gwt-ext
- SVN
- Spring MVC
- zabbix
- @SqlResultSetMapping
- querydsl
- Hudson
- Drools Fusion
Archives
- Today
- Total
목록python replace (1)
봉 블로그
Python replace in file
아래는 파일내 특정문자열을 변경하는 프로그램이다. 단 10분만에 작성한 프로그램인데, 이걸 자바로 하려면 꽤 번거롭다. file inputstream, outputstream 작성해야 하고.. file 목록 뽑아야 하고 등등.. 이런 작업은 python의 생산성이 월등히 높다. java와 python 을 같이 사용한다면 매우좋을듯.. from os import listdir from os.path import isfile, join import codecs def replaceInFile(file_path, old, newstr): f = codecs.open(file_path, 'r', encoding='utf8') read_file = f.read() f.close() new_file = codecs..
Python
2014. 12. 2. 16:16