일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- hive
- math
- django
- c#
- PANDAS
- GIT
- string
- google apps script
- list
- Apache
- dataframe
- PostgreSQL
- 파이썬
- PySpark
- Github
- Tkinter
- Excel
- SQL
- matplotlib
- Google Excel
- gas
- Python
- Java
- Redshift
- Mac
- numpy
- array
- Google Spreadsheet
- Kotlin
- Today
- Total
목록Python (379)
달나라 노트
Heroku를 이용해서 Discord bot을 이용하다보면 동시에 여러 개의 Discord bot을 배포하고 싶을 때가 있습니다. 이런 경우 여러 개의 Discord bot 코드를 가진 python 파일을 적은 후 Procfile을 아래처럼 적으면 됩니다. Procfile test_bot_one: python test_bot_one.py test_bot_two: python test_bot_two.py Procfile에는 Discord bot 코드가 담긴 python파일을 실행시키는 command를 적는 곳입니다. 여기서 콜론(:)을 기준으로 왼쪽은 worker process의 이름입니다. 즉, 내가 원하는대로 정할 수 있는 것이죠. 그리고 콜론(:)을 기준으로 오른쪽은 python 파일을 실행시키는 c..
Heroku에서 discord app을 hosting한 경우 처음에는 무료 시간을 사용하게 됩니다. 무료시간은 다음과 같습니다. 기본 무료 시간 = 550시간 카드 등록한 경우 = 450시간 추가 (-> 총 1000시간의 무료 시간 획득 가능) 먼저 Heroku 홈페이지를 이용하는 방법입니다. Heroku 홈페이지 진입 후 로그인을 해줍시다. 로그인을 한 후 우측 상단에 프로필을 클릭하여 Account settings 버튼을 클릭합니다. 그리고 Billing 탭을 클릭하면 위같은 화면이 나옵니다. 화면을 살펴보면 빨간색으로 표시된 부분에서 지금 1000시간의 무료 시간이 남아있다는 것을 볼 수 있습니다. 이렇게 Free Dyno Usage에서 무료 시간 관련 내용을 볼 수 있습니다. terminal을 이..
Python time 모듈의 sleep method는 Python 코드의 실행을 몇 초 동안 일시정지하는 기능을 가집니다. import time time.sleep(second) 사용법은 간단합니다. sleep method에 sleep할 초를 적어주면 됩니다. import time import datetime dttm_now = datetime.datetime.now() print(dttm_now) time.sleep(20) dttm_now = datetime.datetime.now() print(dttm_now) -- Result 2022-02-22 00:03:49.997681 2022-02-22 00:04:09.999083 위 코드는 약 20초간 sleep하는 코드입니다. 처음에 print되는 현재 ..
Python discord API를 사용할 때 어떤 메세지의 작성자를 불러오는 방법이 있습니다. 먼저 discord.ext.commands를 사용하는 경우입니다. from discord.ext import commands discord_token = 'token_string' client = commands.Bot(command_prefix='/') @client.event async def on_ready(): print('{} logged in.'.format(client)) print('Bot: {}'.format(client.user)) print('Bot name: {}'.format(client.user.name)) print('Bot ID: {}'.format(client.user.id)) ..