일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- servlet
- 객체지향
- Error
- Android
- 이클립스
- Oracle
- 자바문제
- ibatis
- Java
- Mac
- FastAPI
- 컬렉션프레임워크
- 생활코딩
- pyqt
- crud
- 대덕인재개발원
- jsp
- 자바
- python
- ddit
- html
- Homebrew
- spring
- nodejs
- 맥
- 반복문
- API
- 배열
- 단축키
- JDBC
- Today
- Total
목록Python (24)
romworld
python 3.4 버전부터 새로 도입된 파일 경로 및 디렉토리 경로를 다루는 라이브러리. os.path 모듈보다 객체 지향적이고 간편한 방식으로 경로를 조작할 수 있음. pathlib의 클래스인 Path 클래스는 파일이나 디렉토리의 경로를 나타내기 용이함. from pathlib import Path 1. 파일 및 디렉토리 정보 추출 file_path = Path("/path/to/file.txt") print(file_path.name) # 파일명: file.txt print(file_path.stem) # 파일명 (확장자 제외): file print(file_path.suffix) # 확장자: .txt print(file_path.parent) # 부모 디렉토리: /path/to 2. 존재 여부 확..

전에 만들었던 오목게임 파일을 static 패키지에 복사한다. from fastapi import FastAPI,Form,Request import uvicorn from starlette.responses import HTMLResponse, RedirectResponse from starlette.staticfiles import StaticFiles from starlette.templating import Jinja2Templates import pymssql app = FastAPI() app.mount("/static", StaticFiles(directory="static"), name="static") templates = Jinja2Templates(directory="templates"..

1. sqlite에서 테이블을 생성하고 db파일을 복사한다. 2. import를 위한 sqlite-jdbc-3.34.0.jar 파일을 넣어준다. import sqlite3 class DaoMem: def __init__(self): self.conn = sqlite3.connect("mem.db", isolation_level=None) self.cursor = self.conn.cursor() def selects(self): sql = f""" SELECT * FROM member order by m_id desc """ self.cursor.execute(sql) list = self.cursor.fetchall() mdict = [] for i in list: mdict.append({"m_id"..

Apache - TomCat APM : Apache, PHP, Mysql ASP/JSP/PHP ASP : 비주얼 베이직, c#을 가지고 jsp처럼 예전에 사용했던 언어 Apache와 JSP를 결합한 것을 apache-tomcat 자바스크립트 간단 설명 Double 구구단 출력 출력단수: 홀짝 나: 컴: 결과: 로또게임 1. 첫번째 방법. __ __ __ __ __ __ 2. 두번째 방법 __ __ __ __ __ __ 가위바위보 1. 첫번째 방법 나: 컴: 결과: 2. 두번째 방법 나: 컴: 결과: 별찍기 첫번째별수 끝별수: 계산기 출력 계산기 + 배수합 구하기 에서 까지 야구게임 스트라이크:

emp 테이블 crud 화면 구조 emp_list : (리스트) emp_detail : (상세보기) emp_mod (수정폼) emp_mod_act (수정) emp_del_act (삭제) emp_ins act : act가 붙은 건 화면에 띄워지지 않음 EMPLIST - 전체 리스트 출력 from fastapi import FastAPI,Form,Request import uvicorn from starlette.responses import HTMLResponse from starlette.staticfiles import StaticFiles from starlette.templating import Jinja2Templates import pymssql from day10.daoemp import Da..

EMP 테이블을 이용해 (MS SQL 이용) DAO 만들기 import pymssql conn = pymssql.connect(server="", user="sa", password="", database="python", charset='utf8') cursor = conn.cursor() cursor.execute('SELECT * FROM emp;') list = cursor.fetchall() print(list) cursor.close() conn.close() SELECT (전체출력) import pymssql class DaoEmp: def __init__(self): self.conn = pymssql.connect(server="이름", user="sa", password="비밀번호", ..

전에 작성해둔 MS SQL과 연동하는 파일을 참고한다. # pymssql 패키지 import import pymssql # MSSQL 접속 conn = pymssql.connect(server="", user="sa", password="", database="python", charset='utf8') # Connection 으로부터 Cursor 생성 cursor = conn.cursor() # SQL문 실행 cursor.execute('SELECT * FROM emp;') # 데이타 Fetch하여 출력 list = cursor.fetchall() print(list) cursor.close() # 연결 끊기 conn.close() from fastapi import FastAPI,Form,Reques..

POST 로 받기 from fastapi import FastAPI import uvicorn app = FastAPI() @app.get("/") async def root(): return {"message": "Hello World"} @app.get("/param") async def param(a:int=7): return {"param": a} @app.post("/post") async def post(): return {"post": "post"} if __name__ == '__main__': uvicorn.run(app, host="localhost", port=8000) 위에 로직에서 @app.get("/param") async def param(a:int=7): return {"pa..