Python Scratch, Notes

By pjain      Published April 21, 2020, 7:31 p.m. in blog Programming   

PY Learn Notes, Scratch

PY IQ

Panel 1 questions range on sorting, dictionaries in python, runtime complexity of O(1), min, max, defaultdict, sets.

Reverse a string

whiteboard questions were focused on rewriting standard Python library methods like sort()

r Py

Python Programming Tutorials

PY JSON

https://stackoverflow.com/questions/26745519/converting-dictionary-to-json-in-python https://stackoverflow.com/questions/12943819/how-to-prettyprint-a-json-file

Py Data Structures - Pretty print

feed_url = 'http://feeds.bbci.co.uk/news/rss.xml?edition=int#' r = feedparser.parse(feed_url) print(r.feed.title, r.feed.link, r.feed.description, r.feed.updated) # x, r.feed.published)

pprint.pprint(json.loads(json.dumps(r.feed))) pprint.pprint(json.loads(json.dumps(r.entries[0])))

program - arg1nm arg2url

import sys

feed_name = sys.argv[1] feed_url = sys.argv[2]

Time, Date manipulation

import time

print time.strftime("%a, %b %d %I:%M %p")

current_time_millis = lambda: int(round(time.time() * 1000)) current_timestamp = current_time_millis()

TDO: Py Misc

  • Unicode http://docs.python.org/tut/node5.html#SECTION005130000000000000000

  • Py 101 https://fedoramagazine.org/getting-started-python-debugger/

Command line and Basic Systems Programming

Command line and Console IO

File Systems and IO

File Systems for Python $TH File IO in Python $TH

Serialization, JSON

Web and Network Programming and IO

Topics in Python, Best Practices

Idiomatic Python Best Practices - Getting Good

Virtual Env

Setup a Local Python Environment $TH ~x PyCharm for Python Development $TH

Scripting

SSH, Remote Toolchains

IDEs

Write Better Python $TH

Functional Python and Stronger Typing

Py Core, DS, Algo

  • A Byte of Python

x Zed Shaw book, I had put it on hold while I was taking the U of M class, but it is very good... Learn Python the Hard Way by Zed Shaw. Link is here: http://learnpythonthehardway.org/book/

I strongly advise against this resource. It is deliberately obtuse, and outdated. It is literally the hard way to learn Python, and that does not make it a better way to learn.

==== Notes, Scr

Python3 isms

1 function type annotation = can be checked by mypy

def sum(x: int, y: int) -> int: return x + y

  • views def list_lists(request) -> HttpResponse:

PyCore, Algo

Python Data Structures and Algorithms: ProQuest Tech Books kwargs in python - Google Search How to use args and *kwargs in Python - SaltyCrane Blog

Learning Python Design Patterns - Second Edition: ProQuest Tech Books Lesson 1 - Python Programming (Automate the Boring Stuff with Python) - YouTube

Py Fn, HiPerf

  • Pkg https://julien.danjou.info/blog/2017/packaging-python-with-pbr

featherweight attributes Py classes slots

CHROMEXT

~/Library/Application Support/Google/Chrome

PKJ Py Expts Utilities Working

File rename for Android accuracy

import os dir = "." ld = os.listdir(dir) for l in ld: if (l[0]=='.'): continue #print(l) m = l.lower().strip().replace(" ","").replace("-","").replace(",","").replace("\","") os.rename(l,m)

ld = os.listdir(dir)

List image meta data

$ source ~/pyenv36/bin/activate $ brew install libtiff libjpeg webp little-cms2 $ pip install pillow

from PIL import Image, ExifTags import os dir = "." ld = os.listdir(dir) for l in ld: img = Image.open(l) exif = { ExifTags.TAGS[k]: v for k, v in img._getexif().items() if k in ExifTags.TAGS } print(l,exif)


0 comments

There are no comments yet

Add new comment

Similar posts

Python Learning Journey, Notes and Lessons - PKJ

Python Learning Guide and Resources SERIES

Graphs 101

Sublime Text, Plugins and Custom Programming in Python