- window 11
- 开启
适用与 Linx 的 Windows 子系统
- 到微软商店下载
Ubuntu
系统 - 这里我使用的是
WSL1
,wsl --set-default-version <Version>
echo $SHELL
Just create a new InterceptHandler and add it to your app. Different settings should be configured in your config file, so that it is easy to change settings.
Logging is then as easy as:
from loguru import logger
logger.info("I am logging from loguru!")
""" | |
Given a dictionary, transform it to a string. Then byte encode that string. Then base64 encode it and since this will go | |
on a url, use the urlsafe version. Then decode the byte string so that it can be else where. | |
""" | |
data = base64.urlsafe_b64encode(json.dumps({'a': 123}).encode()).decode() | |
# And the decode is just as simple... | |
data = json.loads(base64.urlsafe_b64decode(query_param.encode()).decode()) | |
# Byte encode the string, base64 decode that, then byte decode, finally transform it to a dictionary |
import pandas as pd | |
import pymysql | |
mysql_connection = pymysql.connect(host='localhost', | |
user='root', | |
password='', | |
db='tutorfall2016', | |
charset='utf8', | |
cursorclass=pymysql.cursors.DictCursor) | |
# set 'column_to_update' to 0 when 'condition_column' is 0 | |
df.loc[df['condition_column'] == 0, 'column_to_update'] = 0 | |
# or with a if-then-else scheme | |
df["mycol"] = np.where((df.mycol2=="test"), 0, 1) | |
# condition then else |
Now located at https://github.com/JeffPaine/beautiful_idiomatic_python.
Github gists don't support Pull Requests or any notifications, which made it impossible for me to maintain this (surprisingly popular) gist with fixes, respond to comments and so on. In the interest of maintaining the quality of this resource for others, I've moved it to a proper repo. Cheers!
############################################################################# | |
# Documentation # | |
############################################################################# | |
# Author: Todd Whiteman | |
# Date: 16th March, 2009 | |
# Verion: 2.0.0 | |
# License: Public Domain - free to do as you wish | |
# Homepage: http://twhiteman.netfirms.com/des.html | |
# |