Preview

python cheat sheet v1

Satisfactory Essays
Open Document
Open Document
513 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
python cheat sheet v1
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

  • 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
  • Good Essays

    Nt1310 Unit 4 Lab Report

    • 818 Words
    • 4 Pages

    The purpose of Lab 4 was to experiment with the vi editor commands. In the lab, the “garden” file was edited in many different ways. Many commands were explored in this lab including the ab, U, yy, dd, w, set number, set showmode, and paging commands.…

    • 818 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    IT321 Labs 1.1 - 1.7

    • 2018 Words
    • 38 Pages

    Current configuration : 789 bytes ! version 12.4 no service timestamps…

    • 2018 Words
    • 38 Pages
    Satisfactory Essays
  • Better Essays

    Nt1310 Unit 4

    • 3614 Words
    • 15 Pages

    13. If the following program (myprog) is run from the command line as myprog monday tuesday wednesday thursday? What would be the output?…

    • 3614 Words
    • 15 Pages
    Better 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
  • 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
  • Satisfactory Essays

    5. [3] Ten processes share a critical section implemented by using a semaphore x. Nine…

    • 299 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Intro to Unix Project 2

    • 636 Words
    • 3 Pages

    2- Description of pipes: The symbol | is the Unix pipe symbol that is used on the command line. What it means is that the standard output of the command to the left of the pipe gets sent as standard input of the command to the right of the pipe. Note that this functions a lot like the > symbol used to redirect the standard output of a command to a file. However, the pipe is different because it is used to pass the output of a command to another command, not a file.…

    • 636 Words
    • 3 Pages
    Satisfactory 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

    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
  • 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
  • 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
  • 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

    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
  • Good Essays

    Red Hat Linux Chapter 3

    • 418 Words
    • 2 Pages

    Anaconda is written in C and Python. It identifies hardware, builds the file systems, and installs or upgrades the OS. It can run a TUI, GUI or in batch mode.…

    • 418 Words
    • 2 Pages
    Good Essays