티스토리 뷰
mac에서 불편하던 중 대략 만들어 봤따.
...
@ by ChangYeol,Kim
@ http://umakingtistory.com
'''
pt1 = '/uma/'
pt2 = '.txt'
hostList = ['1.Development', '2.Staging', '4.Production']
def chooseHostList():
hosts = readFile('/etc/hosts')
i = 0
while(i < len(hostList)):
src_buf = readFile(pt1 + hostList[i] + pt2)
if hosts == src_buf:
print '[*', (i+1), '] ', hostList[i]
else:
print '[ ', (i+1), '] ', hostList[i]
i = i + 1
def loopMain():
while True:
print('=====================================')
chooseHostList()
print('-------------------------------------')
inp = input('==>')
if inp > 0 and inp <= len(hostList):
buf = readFile(pt1 + hostList[inp-1] + pt2)
writeFileToHosts(buf)
else:
print()
def readFile(filename):
sf = open(filename)
buf = sf.read()
sf.close()
return buf
def writeFileToHosts(buf):
tf = open('/etc/hosts', 'w')
tf.write(buf)
tf.close()
loopMain()
'내꺼' 카테고리의 다른 글
| css 디버깅 툴 (0) | 2012.07.09 |
|---|---|
| Captcha 같이 영문(대+소)+숫자 를 섞어서 출력하려고 하다가 보니 몇가지를 만들었네. (0) | 2009.11.24 |
| host 정보를 바꿔봐~ (2) | 2009.06.25 |
| 귀찮을때 쓰는 hosts 바꿔치기 batch... (0) | 2009.06.16 |
| hosts (0) | 2009.05.22 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- IViewObject
- BCB
- Python
- jupyter
- javascript
- TShellWindows
- 한영전환
- VCL
- CUDA
- Swift Package Manager
- hosts
- CI
- regexp
- Atom
- ollama
- Xcode
- Copilot
- FindWindows
- IHTMLElement
- Bada
- cudnn
- Profiler
- TensorFlow
- SCM
- CppWebBrowser
- GNUStep
- capture
- Eclipse
- java
- 프로젝트
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
글 보관함