| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- python
- MySQL
- 유니티
- node.js
- GIT
- 함수
- ubuntu
- port
- IOS
- Linux
- tensorflow
- Excel
- 다이어트
- 맛집
- 날짜
- swift
- mssql
- 라즈베리파이
- PyQt
- pandas
- Unity
- MS-SQL
- 리눅스
- javascript
- urllib
- flutter
- PyQt5
- sqlite
- PER
- ASP
목록랭귀지/python (244)
아미(아름다운미소)
이렇게 하려면 필요에 따라 네 가지 방법이 있다.listdir() 메쏘드는 한 디렉토리 안의 모든 파일을 담은 리스트를 돌려준다:import os for filename in os.listdir(r'c:\windows'): print filenamefnmatch() 모듈을 사용하면 파일 이름을 여과할 수 있다.glob 모듈은 listdir()과 fnmatch()를 하나의 모듈 안에 싸넣은 것이다:import glob for filename in glob.glob(r'c:\windows\*.exe'): print filename서브디렉토리를 모을 필요가 있다면, os.path.walk()를 사용하자:import os.path def processDirectory ( args, dirname, filenam..
웹서버 import BaseHTTPServer, SimpleHTTPServer server = BaseHTTPServer.HTTPServer(('',80),SimpleHTTPServer.SimpleHTTPRequestHandler) server.serve_forever()
웹 페이지에서 모든 링크 얻는 법(1) ... 정규 표현식의 마법을 활용하면.import re, urllib htmlSource = urllib.urlopen("http://sebsauvage.net/index.html").read(200000) linksList = re.findall('.*?',htmlSource) for link in linksList: print link 웹 페이지에서 모든 링크 얻는 법(2) HTMLParser 모듈을 사용할 수도 있다.import HTMLParser, urllib class linkParser(HTMLParser.HTMLParser): def __init__(self): HTMLParser.HTMLParser.__init__(self) self.links = [..
FTP를 사용하여 파일 전송하는 법 from win32com.client import gencache import ftplib # FTP 모듈 반입 session = ftplib.FTP('mysite.com','login','passord') # FTP 서버에 접속 uploadfile = open('upload.txt','rb') # 전송할 파일 열기 session.storbinary('STOR upload.txt', uploadfile) # 파일 전송 uploadfile.close() # 파일 닫기 session.quit() # FTP 세션