Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- ubuntu
- nGrinder
- GoCD
- ssh
- Materials
- SWIFT
- insert
- Jupyter
- STF
- 실행권한
- ftp
- kitura
- 28015
- STF_PortForwarding
- mysql
- sshpass
- Jupyter Notebook
- rethinkdb
- create table
- perfect
- appium
- postgresql
- nohup
- appium server
- openpyxl
- postgres
- centos
- port forwarding
- PYTHON
- nmap
Archives
- Today
- Total
don't stop believing
blockchain 테스트에 사용한 python 함수 - getDateStrings 본문
Blockchain 테스트에 사용한 함수를 정리해 보겠습니다.
blockchain 테스트에 사용한 python 함수를 설명합니다.
- getDateStrings - 날짜 - 년, 월, 일, 시, 분, 초를 확인하는 함수입니다.
- getLogfileNameWithPath - 로그 기록을 위해 폴더를 생성하고 경로를 반환합니다.
- getRequestId - ramdom으로 숫자를 반환합니다.
- moveFile - 특정 파일을 로그 폴더로 이동시킵니다.
- saveResultData - 데이터를 파일에 저장합니다.
- convertToHex - String을 hex로 변환합니다.
- leftPad64 - 왼쪽에 (또는 오른쪽에) 0을 채워 고정된 길이로 만듭니다.
- getTestConfig - json 형태의 config 파일을 만들고 불러옵니다.
- waitingCount - time.sleep() 할 때 동적으로 카운트를 셉니다.
- callRPC - requests 모듈을 사용해 http API를 호출합니다.
- callWS - websocket 모듈을 사용해 API 통신을 합니다.
날짜 - 년, 월, 일, 시, 분, 초를 확인하는 함수입니다.
timestemp 형식으로도 확인합니다.
getDateStrings는 3개의 튜플 데이터를 리턴합니다.
12345678910111213141516171819202122232425262728293031# coding=utf-8import time, datetimeclass nGleUtils():def getDateStrings(self):'''날짜를 확인하기 위해 여러 형태로 날자 데이터를 불러옵니다.'''# 2018-12-17 15:09:47.003753i = datetime.datetime.now()# 2018-12-17 15:09:47dt = datetime.datetime(i.year, i.month, i.day, i.hour, i.minute, i.second)# 1545026987.0ts = time.mktime(dt.timetuple())return (i, dt, ts)if __name__== "__main__":ngle = nGleUtils()i, dt, ts = ngle.getDateStrings()print(i)print(dt)print(ts)
3개의 튜플 리턴 데이터 중 timestemp 형태의 3번째 것만 사용하고 싶다면 사용하지 않는 리턴 값은 '_'로 받으면 됩니다.
_, _, ts = ngle.getDateStrings()
'Python > Basic' 카테고리의 다른 글
blockchain 테스트에 사용한 python 함수 - getRequestId (0) | 2018.12.17 |
---|---|
blockchain 테스트에 사용한 python 함수 - getLogfileNameWithPath (0) | 2018.12.17 |
if condition 한 줄로 쓰기 (one-liner) (3) | 2018.12.09 |
f-string 문자열에 변수 넣기 (3.6) (0) | 2018.10.20 |
Python 3.x 설치 (on CentOS7) (3) | 2018.10.15 |
Comments