일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- MySQL
- PyQt
- Unity
- python
- ubuntu
- port
- urllib
- 다이어트
- 유니티
- Linux
- 날짜
- swift
- node.js
- PyQt5
- pandas
- Excel
- MS-SQL
- javascript
- PER
- GIT
- 맛집
- mssql
- 함수
- IOS
- 라즈베리파이
- ASP
- 리눅스
- tensorflow
- sqlite
- flutter
목록분류 전체보기 (983)
아미(아름다운미소)
File Size in Bytes 파이썬에서는 os.path.getsize() 함수를 사용하여, 지정해 준 파일의 사이즈를 바이트 단위로 구할 수 있습니다. 바이트 단위의 크기에서, 나누기 1024 를 해주면 킬로바이트 단위로 크기를 구할 수 있고 1024 곱하기 1024 즉, 1048576 으로 나누어 주면 메가바이트 단위의 사이즈를 얻을 수 있습니다. #!/usr/bin/python # -*- coding: utf-8 -*- import os try: n = os.path.getsize("remotefile.zip") print n, "Bytes" # 바이트 단위로 구하기 print n / 1024, "KB" # 킬로바이트 단위로 print "%.2f MB" % (n / (1024.0 * 1024.0..
다음은 Python 3 스크립트에서 특정 출력에 색상을 지정하는 데 사용하는 클래스입니다 EX) from colorprint import ColorPrint as _ _.print_fail('Error occurred, quitting program') Class)import sys # Colored printing functions for strings that use universal ANSI escape sequences. # fail: bold red, pass: bold green, warn: bold yellow, # info: bold blue, bold: bold white class ColorPrint: @staticmethod def print_fail(message, end = '\n..
하위 디렉터리 검색을 쉽게 해주는 os.walk os.walk를 이용하면 하위 디렉터리 검색을 간편하게 만들 수 있습니다다. os.walk는 시작 디렉터리부터 시작하여 그 하위의 모든 디렉터리를 차례대로 방문하게 해주는 함수입니다. import os for (path, dir, files) in os.walk("c:/"): for filename in files: ext = os.path.splitext(filename)[-1] if ext == '.py': print("%s/%s" % (path, filename)) 디렉터리와 파일을 검색하는 일반적인 경우라면 os.walk를 사용하는 것을 추천합니다.
ffmpeg -formats 명령으로 지원되는 샘플 형식 목록을 볼 수 있습니다. $ ffmpeg -formats | grep PCM DE alaw PCM A-law DE f32be PCM 32-bit floating-point big-endian DE f32le PCM 32-bit floating-point little-endian DE f64be PCM 64-bit floating-point big-endian DE f64le PCM 64-bit floating-point little-endian DE mulaw PCM mu-law DE s16be PCM signed 16-bit big-endian DE s16le PCM signed 16-bit little-endian DE s24be PCM sig..
방법1 from datetime import datetime dt = datetime.now() dt.microsecond 방법2 from datetime import datetime dt = datetime.now() print dt.microsecond/1000 + dt.second*1000 밀리 초 단위로 현재 UTC 시간을 얻는 가장 간단한 방법 # timeutil.py import datetime def get_epochtime_ms(): return round(datetime.datetime.utcnow().timestamp() * 1000) # sample.py import timeutil timeutil.get_epochtime_ms()
abs(x)는 어떤 숫자를 입력으로 받았을 때, 그 숫자의 절대값을 돌려주는 함수 입니다. >>> abs(3) 3 >>> abs(-3) 3 >>> abs(-1.2) 1.2
open(filename, [mode])은 "파일 이름"과 "읽기 방법"을 입력받아 파일 객체를 리턴하는 함수입니다. 읽기 방법(mode)이 생략되면 기본값인 읽기 전용 모드(r)로 파일 객체를 만들어 리턴합니다. mode설명 w쓰기 모드로 파일 열기 r읽기 모드로 파일 열기 a추가 모드로 파일 열기 b바이너리 모드로 파일 열기 b는 w, r, a와 함께 사용됩니다. >>> f = open("binary_file", "rb") 위 예의 rb는 "바이너리 읽기 모드"를 의미합니다. 아래 예의 fread와 fread2는 동일한 방법입니다. >>> fread = open("read_mode.txt", 'r') >>> fread2 = open("read_mode.txt") 즉, 모드 부분이 생..
FFmpeg 옵션 코드 입니다. 입력부분은 인코딩설정-매개변수 창에서 코드 입력 수정 하여 사용하실수 있습니다. -b set bitrate (in bits/s) (비트레이트 조정) -vb set bitrate (in bits/s) (가변비트레이트 조정) -vframes number set the number of video frames to record -r rate set frame rate (Hz value, fraction or abbreviation)(프레임 레이트 조정) -s size set frame size (WxH or abbreviation)(프레임 사이즈 조정) -aspect aspect set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)(비율조정 4:3..
Function AddZero(Str) IF len(Str)=1 Then AddZero="0"&Str Else AddZero=Str End IF End Function '사용법 Response.write AddZero(1) &"월 " Response.write AddZero(2) &"월 " Response.write AddZero(3) &"월 " '결과값 01월 02월 03월
subprocess call ffmpeg (command line) # -*- coding: utf-8 -*- ''' Created on 2018. 8. 14. @author: bhm ''' import os from subprocess import call os.chdir('D://ffmpeg/bin/') call('ffmpeg -i file.mp3 -c:a g723_1 -ar 8000 -ac 1 -b:a 6.3K output.wav', shell=True)