반응형

소스 코드 353

[python] 뉴스 검색기V04 feat.네이버 개발자센터

DB 설계 CREATE TABLE [dbo].News ( [nid] INT NOT NULL PRIMARY KEY IDENTITY, [title] VARCHAR(200) NOT NULL, [link] VARCHAR(200) NOT NULL, [description] VARCHAR(MAX) NOT NULL, [pubdate] DATETIME NOT NULL, [mcnt] int NOT NULL CONSTRAINT TU UNIQUE(link) ) =================================================== CREATE TABLE [dbo].Morpheme ( [mid] INT NOT NULL PRIMARY KEY IDENTITY, [word] VARCHAR(50) NOT NUL..

[ python] 뉴스 분석기 feat.네이버 개발자센터 , 형태소 분석

News.py #News.py class News: def __init__(self,title,link,description,pubdate): self.title = title self.link = link self.description = description self.pubdate = pubdate @staticmethod def MakeNews(jnews): title = jnews['title'] link = jnews['link'] description = jnews['description'] pubdate = jnews['pubDate'] return News(title,link,description,pubdate) Morpheme.py #Morpheme.py - 형태소 클래스 class Mo..

[python] 뉴스 검색 - 형태소 분석 (feat. 네이버 개발자센터)

Main.py import urllib.request import json class Morpheme: def __init__(self,word): self.word = word self.ref = 1 def Merge(self,other): if self.IsEqual(other): self.ref = self.ref + other.ref def IsEqual(self,other): return self.word == other.word class MorphemeParser: @staticmethod def Parse(src): morphes = list() #반환할 형태소 컬렉션 src = MorphemeParser.RemoveNonAlpha(src) msrc = src.split(' ') for e..

[python] 도서 검색기 feat. 네이버 개발자센터

Book.py #Book.py class Book: def __init__(self,title,author,price,content="",publisher="",link="",imglink=""): self.title = title self.author = author self.price = price self.content = content self.publisher = publisher self.link = link self.imglink=imglink NaverBookSearcher.py #NaverBookSearcher.py import urllib.request import json from Book import Book class NaverBookSearcher: @staticmethod de..

[python] 네이버 도서 검색 API 활용 - Json

Book.py #Book.py class Book: def __init__(self,title,author,price,content="",publisher="",link="",imglink=""): self.title = title self.author = author self.price = price self.content = content self.publisher = publisher self.link = link self.imglink=imglink NaverBookSearcher.py #NaverBookSearcher.py import urllib.request import json from Book import Book class NaverBookSearcher: @staticmethod de..

[python] EH 쇼핑몰 - 고객 관리, 상품 관리 - MSSQL, QT

CustomSql.py #CustomSql.py import pymssql class CustomSql: def AddCustom(self, cid, cname): conn = pymssql.connect("127.0.0.1:1433","sa","1234","BigPro") cursor = conn.cursor() query =str.format("insert into Custom (CID, CNAME) values('{0}','{1}')", cid,cname) cursor.execute(query) conn.commit() conn.close() def RemoveCustom(self, ckey): conn = pymssql.connect("127.0.0.1:1433","sa","1234","BigPr..

[python] 고객 관리 - QT, MSSQL

CustomSql.py #CustomSql.py import pymssql class CustomSql: def AddCustom(self, cid, cname): conn = pymssql.connect("127.0.0.1:1433","sa","1234","BigPro") cursor = conn.cursor() query =str.format("insert into Custom (CID, CNAME) values('{0}','{1}')", cid,cname) cursor.execute(query) conn.commit() conn.close() def RemoveCustom(self, ckey): conn = pymssql.connect("127.0.0.1:1433","sa","1234","BigPr..

[python] 상품 조회 응용 - MSSQL, QT 사용

ProductSql.py #ProductSql.py import pymssql class ProductSql: def AddProduct(self, pid,pname,price): conn = pymssql.connect("localhost","sa","1234","BigPro") cursor = conn.cursor() query =str.format("insert into Product (PID, PNAME, Price) values('{0}','{1}',{2})", pid,pname,price) cursor.execute(query) conn.commit() conn.close() def RemoveProduct(self,pkey): conn = pymssql.connect("localhost","..

[python - QT] 리스트 박스 사용하기 - QListWidget

항목 추가 : addItem(항목) 항목 삭제: takeItem(항목 인덱스) 모든 항목 삭제: clear() 선택 항목 변경 이벤트: currentItemChanged 공식 QT 문서에서 자세히 살펴보기 MyWidget.py #MyWidget.py from PyQt5.QtWidgets import * from PyQt5.QtGui import * class MyWidget(QWidget): def __init__(self): super().__init__() self.setWindowTitle("리스트 박스 사용 데모") self.resize(1000,800) self.lbox = QListWidget(self) self.lbox.resize(400,600) self.te=QTextEdit(self) ..

[python] QT, MSSQL 활용 - 상품 등록하기

Product 테이블 CREATE TABLE [dbo].[Product] ( [PId] VARCHAR (50) NOT NULL, [PName] VARCHAR (50) NOT NULL, [Price] INT NOT NULL, [PKey] INT IDENTITY (1, 1) NOT NULL, CONSTRAINT [PK__Product__C57755405495D0B5] PRIMARY KEY CLUSTERED ([PKey] ASC), CONSTRAINT [AK_PID] UNIQUE NONCLUSTERED ([PId] ASC) ); ProductSql.py #ProductSql.py import pymssql class ProductSql: def AddProduct(self, pid,pname,price): c..

반응형