Category:Python
Revision as of 18:14, 23 September 2023 by RobertBushman (talk | contribs)
buffering
Fix CLI buffering in Python with:
$ python -u foo.py | tee mylog.log
"-u" means unbuffered, or something
Virtual Environments
What Libs Have I?
$ pip freeze --local
blinker==1.6.2
click==8.1.7
flask==2.3.3
importlib-metadata==6.8.0
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.3
werkzeug==2.3.7
zipp==3.16.2
Package Info
Datetime and Timestamp
When including time, use one of the following: pytz.utc.localize(datetime.utcfromtimestamp(ts)) = 1970-01-01 00:00:00+00:00 datetime.fromtimestamp(ts, timezone.utc) = 1970-01-01 00:00:00+00:00 int(dt_with_tz.timestamp()) = 0 pytz.utc.localize(datetime.utcnow()) = 2023-09-23 17:33:18.399692+00:00 int(now_dt.timestamp()) = 1695490398 datetime.fromtimestamp(now_ts, timezone.utc) = 2023-09-23 17:33:18+00:00
Pages in category "Python"
The following 7 pages are in this category, out of 7 total.