QTemporaryDir
C+11 support
Now, I'm not feeling lazy and not going to write all the doc. See all the links in New Features section: https://wiki.qt.io/Template:Release_Information
QTemporaryDir
C+11 support
Now, I'm not feeling lazy and not going to write all the doc. See all the links in New Features section: https://wiki.qt.io/Template:Release_Information
| def greeting(expr): | |
| def greeting_decorator(func): | |
| def function_wrapper(x): | |
| print(expr + ", " + func.__name__ + " returns:") | |
| func(x) | |
| return function_wrapper | |
| return greeting_decorator | |
| @greeting("καλημερα") | |
| def foo(x): | 
| import zipfile | |
| zip = zipfile.ZipFile('Archive.zip', 'r') | |
| print(zip.namelist()) | |
| for meta in zip.infolist(): | |
| print(meta) | |
| print(zip.read(("wishlist.txt"))) | 
| import itertools | |
| for x in itertools.count(50, 5): | |
| print(x) | |
| if x == 80: | |
| break | |
| for x in itertools.count(50): | |
| print(x) | |
| if x == 80: | 
| import random | |
| print(random.sample(range(100), 5)) | |
| print(random.sample(["Fish", "Dog", "Cat"], 1)) | |
| print(random.choice(["Fish", "Dog", "Cat"])) | |
| pets=["Fish", "Dog", "Cat", "Parrot"] | |
| random.shuffle(pets) | |
| print(pets) | 
| length() : specifies the string length | |
| split(char) : splits the string by char | |
| trim() : trims whitespaces from start and end | |
| toUpperCase() : upper cases the entire string | |
| toLowerCase() : lower cases the entire string | |
| Mathematical: | |
| parseInt() : | |
| parseFloat() : | |
| toFixed(int) : pads with zero else acts as round(); returns string | 
| Interpreter candy | |
| help() - help for specified object | |
| dir() - like ls for a class | |
| type() - object type | |
| print() - print object | |
| len() - length of object | |
| id() - returns id of an object | |
| input() - takes input from stdin | |
| exec() | |
| range() - sequence type | 
| # Upgrade to Python 3. | |
| import os | |
| os.makedirs("plates/jpg", exist_ok=True) | |
| os.makedirs("plates/exr", exist_ok=True) | |
| os.makedirs("roto/renders", exist_ok=True) | |
| os.makedirs("matchmove", exist_ok=True) | 
| import logging | |
| # logging levels | |
| # https://docs.python.org/3.6/library/logging.html#logging-levels | |
| # https://docs.python.org/3.6/library/logging.html#logrecord-attributes | |
| logging.basicConfig(filename='logger.log', | |
| filemode='w', | |
| format='%(lineno)d %(levelname)s: %(asctime)s %(funcName)s %(message)s %(thread)d', | |
| level=logging.WARNING) | 
| import threading | |
| import time | |
| def calc_square(numbers): | |
| print("calculate square numbers") | |
| for n in numbers: | |
| time.sleep(0.2) | |
| print('square', n*n) | |
| def calc_cube(numbers): |