python cheat sheet v1

Satisfactory Essays
sys Variables

String Methods

Datetime Methods

capitalize() *

lstrip()

today()

fromordinal(ordinal)

builtin_module_names Linked C modules

center(width)

partition(sep)

now(timezoneinfo)

combine(date, time)

byteorder

Native byte order

count(sub, start, end)

replace(old, new)

utcnow()

strptime(date, format)

check_interval

Signal check frequency

decode()

rfind(sub, start ,end)

fromtimestamp(timestamp) utcfromtimestamp(timestamp) argv

Command line args

exec_prefix

Root directory

encode()

rindex(sub, start, end)

executable

Name of executable

endswith(sub)

rjust(width)

exitfunc

Exit function name

expandtabs()

rpartition(sep)

modules

Loaded modules

find(sub, start, end) rsplit(sep)

path

Search path

index(sub, start, end)

rstrip()

replace()

utcoffset()

platform

Current platform

isalnum() *

split(sep)

isoformat()

dst()

stdin, stdout, stderr

File objects for I/O

isalpha() *

splitlines()

__str__()

tzname()

version_info

Python version info

isdigit() *

startswith(sub)

strftime(format)

winver

Version number

islower() *

strip()

isspace() *

swapcase() *

istitle() *

title() *

sys.argv for $ python foo.py bar -c qux --h

Time Methods

Date Formatting (strftime and strptime)

isupper() *

translate(table)

%a Abbreviated weekday (Sun)

foo.py

join()

upper() *

%A Weekday (Sunday)

sys.argv[1]

bar

ljust(width)

zfill(width)

sys.argv[2]

-c

lower() *

sys.argv[0]

sys.argv[3]

qux

sys.argv[4]

--h

%b Abbreviated month name (Jan)
%B Month name (January)
%c Date and time

Note

Methods marked * are locale dependant for 8-bit strings.

%d Day (leading zeros) (01 to 31)
%H 24 hour (leading zeros) (00 to 23)
%I 12 hour (leading zeros) (01 to 12)

os Variables

%j

List Methods

Day of year (001 to 366)

altsep

Alternative sep

curdir

Current dir string

append(item)

pop(position)

defpath

Default search path

count(item)

remove(item)

%p AM or PM

devnull

Path of null device

extend(list)

reverse()

%S

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Buad 310 Cheat Sheet

    • 703 Words
    • 3 Pages

    * Coefficient of Variation: defined as the ratio of SD to the mean, has no units, usually is expressed as a percentage, indicates how large SD is relative to the mean…

    • 703 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    cheat sheet

    • 1437 Words
    • 5 Pages

    1. The sociological perspective, as a way of thinking about the world, includes the sociological imagination from C. Wright Mills, the beginner’s mind from Bernard McGrane, and the idea of culture shock from anthropology. Explain what all three of these concepts have in common.…

    • 1437 Words
    • 5 Pages
    Good Essays
  • Powerful Essays

    cheat sheet

    • 1430 Words
    • 6 Pages

    3. Find all employees who live in the same city and street as their manager (3 pts)…

    • 1430 Words
    • 6 Pages
    Powerful Essays
  • Good Essays

    ids cheat sheet

    • 988 Words
    • 3 Pages

    An operation increases its production level and observes that the cost of producing each unit decreases.…

    • 988 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Statistics Cheat Sheet

    • 2126 Words
    • 11 Pages

    What proportion of a normal distribution is located in the tail beyond z = +2.00?…

    • 2126 Words
    • 11 Pages
    Good Essays
  • Satisfactory Essays

    b. Genes can act indirectly by making it more likely you will be raised in a particular environment.…

    • 1079 Words
    • 6 Pages
    Satisfactory Essays
  • Good Essays

    stat 202 cheat sheet

    • 509 Words
    • 3 Pages

    r2 = fraction of variation in one variable that is explained by least-squares on the other variable…

    • 509 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    AP Style Guide Cheat Sheet

    • 1840 Words
    • 15 Pages

    ● To subscribe to The Associated Press Stylebook online, or to find out about purchasing hard copies of the book, start here.…

    • 1840 Words
    • 15 Pages
    Powerful Essays
  • Satisfactory Essays

    ap study guide

    • 1236 Words
    • 5 Pages

    Like the Romans and the Hans, the collapse of the Gupta state was partially caused by an invasion of the ?…

    • 1236 Words
    • 5 Pages
    Satisfactory Essays
  • Powerful Essays

    Exam Cheat Sheet

    • 6135 Words
    • 25 Pages

    Abbreviations |B.P. Bond Payable |PIC Paid In Capital.| |C.S. Common Stock |APIC Additional PIC | |CSE Common SE |PMR Profit Margin | |EOF End of |Ratio…

    • 6135 Words
    • 25 Pages
    Powerful Essays
  • Powerful Essays

    Module 6 Study Guide

    • 13344 Words
    • 54 Pages

    Clean gloves should be worn whenever administering an injection to reduce the risk of a secondary infection. To avoid an accidental needle stick you should not recap the needle after administering the injection. The needle safety device should be activated and/or the needle and syringe placed in a sharps container. To obtain maximum effectiveness, the alcohol…

    • 13344 Words
    • 54 Pages
    Powerful Essays
  • Good Essays

    Module 5 Study Guide

    • 2729 Words
    • 11 Pages

    A. Preoccupation with fears of contracting, or the idea that one has a serious disease based on misinterpretation of bodily symptoms…

    • 2729 Words
    • 11 Pages
    Good Essays
  • Satisfactory Essays

    Study Guide 3

    • 313 Words
    • 2 Pages

    Study guide for bio112 exam #3 The Animals: General characteristics: 1. multicellular heterotrophs 2. Divers in form 3. No cell walls 4. Active movement 5. Sexual reproduction 6. Embryo development(zygote>morula>blastula>blastopore/gastrula) Parazoans VS Eumetazoans. Eumetazoans as triploblastic organisms. Eumetazoan…

    • 313 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Study Guide 1

    • 1290 Words
    • 6 Pages

    18th century - pleasure garden songs - landscaped gardens for dining and strolling had musical entertainment. Popularity led to publishing of the songs.…

    • 1290 Words
    • 6 Pages
    Powerful Essays
  • Satisfactory Essays

    Cheat Sheet

    • 341 Words
    • 2 Pages

    AAY703-Allegiant 703,cleared to Orlando Sanford International Airport, Atlanta, J45, Ormond Beach, then as filed. Maintain 5000. Expect FL330 one zero minutes after departure.Departure frequency125.1. Squawk XXXX.…

    • 341 Words
    • 2 Pages
    Satisfactory Essays