Python/이것저것 파이썬
-
[Python] WIFI QRcode 만들기Python/이것저것 파이썬 2023. 2. 4. 18:33
qrcode 라이브러리를 설치한다. pillow에 의존하기 때문에 같이 설치할 때는 다음과 같이... pip install "qrcode[pil]" 코드는 다음과 같다. import qrcode ssid = 'abcde' security = 'WPA' # WPA or WEP password = 'abcde' img = qrcode.make(f'WIFI:S:{ssid};T:{security};P:{password};;') img.save("wifi_qrcode.png") svg 파일로도 출력할 수 있다. import qrcode import qrcode.image.svg ssid = 'abcde' security = 'WPA' # WPA or WEP password = 'abcde' factory = qr..
-
파이썬 정렬Python/이것저것 파이썬 2022. 12. 31. 20:56
기본 print(sorted([5, 2, 3, 1, 4])) # [1, 2, 3, 4, 5] print(sorted([5, 2, 3, 1, 4], reverse=True)) # [5, 4, 3, 2, 1] a = [5, 2, 3, 1, 4] a.sort() print(a) # [1, 2, 3, 4, 5] print(sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'})) # [1, 2, 3, 4, 5] 키 student_tuples = [ ('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10), ] print(sorted(student_tuples, key=lambda student: student[2])) # sort by a..
-
사다리 게임Python/이것저것 파이썬 2022. 12. 28. 22:32
from random import randint, shuffle def main(member_num, line_num): members = list(range(1, 1 + member_num)) # 1번부터 targets = list(chr(each + ord('A')) for each in range(member_num)) # A 부터 ladder = [[False for _ in range(member_num - 1)] for _ in range(line_num)] # 가로선 선택 full_col = set(range(line_num)) prev_col = set() for i in range(member_num - 1): # 좌에서 우로, 마지막 열은 가로선 없음. temp = list(full_c..
-
pyttsx3Python/이것저것 파이썬 2022. 12. 23. 15:39
pip install pyttsx3 import pyttsx3 engine = pyttsx3.init() engine.setProperty('rate', 120) engine.say('안녕하세요?') engine.runAndWait() https://github.com/nateshmbhat/pyttsx3 GitHub - nateshmbhat/pyttsx3: Offline Text To Speech synthesis for python Offline Text To Speech synthesis for python. Contribute to nateshmbhat/pyttsx3 development by creating an account on GitHub. github.com https://pyttsx3.r..
-
파이참, 깃헙 데스크탑 초기 설정Python/이것저것 파이썬 2022. 12. 23. 10:37
파이참 공식 기능을 쓰십시오. 파이참도 공식적으로 깃헙을 지원하기 때문에 파이참에서 제공되는 기능을 쓰면 됩니다. 저는 깃헙 데스크탑만 쓰는 게 편해서 저는 깃헙을 GUI로 시작했고.... 이런 저런 개발환경을 두루 두루 사용해 오다 보니, 파이참의 깃헙 지원보다는 깃헙 데스크탑이 편해서... 이런 방법으로 레포지토리를 생성합니다. 깃헙 데스크탑만으로 기존 폴더를 레포지토리로 설정하는 법 이 글은 깃헙 데스크탑 만으로 기존 폴더를 레포지토리로 설정하는 법에 대한 글입니다. 저는 로컬에서 어느 정도 작업이 이루어진 뒤에, 깃헙에 올리는 경우가 많습니다. 그런데 깃헙 데스크탑의 메뉴에 있는 'New repository...'로 폴더를 생성하면 선택한 폴더 아래에 하위폴더가 생성되고, 하위폴더가 새로운 레포지..
-
ttkbootstrapPython/이것저것 파이썬 2022. 12. 22. 18:31
https://ttkbootstrap.readthedocs.io/en/latest/themes/ Themes - ttkbootstrap Themes ttkbootstrap comes packaged with a LOT of beautifully styled light and dark themes, which you can view in a demo by typing this command into your terminal after installing ttkbootstrap. >>> python -m ttkbootstrap You will see a demo screen that look ttkbootstrap.readthedocs.io https://github.com/israel-dryer/ttkbo..
-
파이썬 MS Windows 내장 TTS 활용Python/이것저것 파이썬 2022. 12. 1. 13:10
파이썬 TTS를 검색하면 gTTS가 가장 많이 검색됩니다. 구글의 API를 이용해서 mp3로 받아오는 건데.... 꽤 불편합니다. 윈도우에도 TTS기능이 내장되어 있는데요. 오프라인에서 작동하고, 음질도 나쁘지 않습니다. https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ms723627(v=vs.85) Microsoft Speech API (SAPI) 5.3 Table of contents Microsoft Speech API (SAPI) 5.3 Article 04/17/2012 2 minutes to read In this article --> Microsoft Speech API 5.3 Microsoft Speech API (SA..
-
(서브 폴더 포함) 전체 파일 해시 추출Python/이것저것 파이썬 2022. 10. 28. 09:57
[Q] 폴더와 파일 이름과 용량 등을 비교하여 파일 매칭을 해야하는데요. 네트워크로는 공유가 안되고 복사하기엔 용량이 너무 큰 상태입니다. ------------------------------- [A] 각 PC에서, 파일 패스, 파일 사이즈, 해시값을 출력한 뒤 이 값들을 비교하는 게 좋을 것 같습니다. 해시의 원리상 같은 파일일 경우 해시 값은 항상 같습니다. 다른 파일일 경우 해시 값이 같을 확률이 아주 약간 있습니다만, 파일 크기까지 비교한다면 그 확률을 더 줄일 수 있습니다. import os import hashlib def check_dir(path): for root, _, files in os.walk(path): for file in files: joined_path = os.path...