일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- swift
- Linux
- flutter
- 날짜
- PyQt
- Unity
- 맛집
- node.js
- port
- urllib
- pandas
- python
- MySQL
- javascript
- 리눅스
- ASP
- 다이어트
- PyQt5
- 라즈베리파이
- 유니티
- MS-SQL
- 함수
- sqlite
- IOS
- tensorflow
- Excel
- PER
- mssql
- GIT
- ubuntu
목록랭귀지 (557)
아미(아름다운미소)
subprocess 모듈을 이용한 명령어 실행 #-*- coding: utf-8 -*- import subprocess subprocess.Popen('.\folder\program.exe')
PyQt5 , QAction 사용하여 menubar 만들기 #-*- coding: utf-8 -*- ''' Created on 2018. 11. 29. @author: bhm ''' from PyQt5.QtWidgets import QMainWindow, QAction, qApp, QApplication from PyQt5.QtGui import QIcon class Example(QMainWindow): def __init__(self): super().__init__() exit_action = QAction(QIcon('exit.png'), "&Exit", self) # exit_action = QAction('&Exit', self) exit_action.setShortcut('Ctrl+Q') e..
현재 날짜 시간 결과)
문자열을 입력받아 그 문자열에서 숫자만 제거하고 출력 #-*- coding: utf-8 -*- ''' Created on 2018. 11. 26. @author: bhm ''' import re char = "123abcdefghi4jk56" p = re.compile("[^0-9]") print("".join(p.findall(char))) 결과) abcdefghijk
Python PyQt5 combobox import sys from PyQt5 import QtCore, QtWidgets from PyQt5.QtWidgets import QMainWindow, QLabel, QGridLayout, QWidget, QComboBox from PyQt5.QtCore import QSize, QRect class ExampleWindow(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.setMinimumSize(QSize(300, 300)) self.setWindowTitle("PyQt5 Combobox example") centralWidget = QWidget(self) self.setCentralW..
python 리스트 슬라이싱 파이썬 리스트에 있는 데이터에 하나씩 접근할 때는 인덱싱을 사용하면 됩니다.그런데 리스트에 있는 여러 개의 데이터에 동시에 접근하려면 이럴 때 사용하는 것이 바로 파이썬 슬라이싱입니다. 파이썬 리스트의 슬라이싱은 문자열 슬라이싱과 동일합니다.kospi_top10 = ['삼성전자', 'SK하이닉스', '현대차', '한국전력', '아모레퍼시픽', '제일모직', '삼성전자우', '삼성생명', 'NAVER', '현대모비스'] print("시가총액 3위: ", kospi_top10[2]) >>시가총액 3위: '현대차' kospi_top5 = kospi_top10[0:5] kospi_top5 >>['삼성전자', 'SK하이닉스', '현대차', '한국전력', '아모레퍼시픽'] kospi_t..
json은 URL요청시 입출력 데이터로 많이 활용됩니다. 예제) import json import urllib.request url = "http://www.test.com" # URL d = {'name': '테스트', 'birth': '0703', 'age': 47} params = json.dumps(d).encode("utf-8") # encode: 문자열을 바이트로 변환 req = urllib.request.Request(url, data=params, headers={'content-type': 'application/json'}) response = urllib.request.urlopen(req) print(response.read().decode('utf8')) # decode: 바이트를..
pyqt5 QTableWidget QTableWidget() 으로 생성 합니다. row, column 을 설정합니다. 아이템을 설정합니다. self.itemTable = QTableWidget() self.itemTable.setRowCount(2) self.itemTable.setColumnCount(2) self.itemTable.setItem(0, 0, QTableWidgetItem("(0,0)")) self.itemTable.setItem(0, 1, QTableWidgetItem("(0,1)")) self.itemTable.setItem(1, 0, QTableWidgetItem("(1,0)")) self.itemTable.setItem(1, 1, QTableWidgetItem("(1,1)")) 동..
python file copy import shutil shutil.copy2('/src/dir/file.ext', '/dst/dir/newname.ext') shutil.copy2('/src/file.ext', '/dst/dir')
python print를 로그파일로 생성하기 import sys class Tee(object): def __init__(self, *files): self.files = files def write(self, obj): for f in self.files: f.write(obj.encode('utf-8')) if __name__ == "__main__": f = open('logfile.txt', 'w') original = sys.stdout sys.stdout = Tee(sys.stdout, f) print "test~" # This will go to stdout and the file out.txt #use the original sys.stdout = original print "Test lo..