Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
61 Cards in this Set
- Front
- Back
Formatting operator for a character |
%c |
|
Formatting operator for a string |
%s |
|
Formatting operator for a signed decimal integer |
%i and %d |
|
Formatting operator for an unsigned octal integer |
%o |
|
Formatting operator for an unsigned integer |
%u |
|
Formatting operator for an unsigned hexadecimal integer (lowercase letters) |
%x |
|
Formatting operator for an unsigned hexadecimal integer (uppercase letters) |
%X |
|
Formatting operator for exponential notation (with lowercase 'e') |
%e |
|
Formatting operator for exponential notation (with uppercase 'E') |
%E |
|
Formatting operator for a floating point decimal real number |
%f and %F |
|
Formatting operator for an exponent if large or small enough, or an integer otherwise |
%g and %G |
|
What is the difference between a signed and an unsigned integer formatting operator? |
Signed integers show whether the ingeger is positive or negative (+ or -), while unsigned integers do not |
|
What is the prefix for raw strings and what are they? |
r'example raw string' Raw strings display exactly as typed |
|
What is the prefix for unicode strings and what are they? |
u'example unicode string' Unicode strings allow a greater number of characters to be displayed |
|
What character is used for left justification? |
- (dash) |
|
What is used to leave a blank space before a positive number? |
<sp> |
|
What is used to add the octal leading zero ( '0' ) or hexadecimal leading '0x' or '0X'? |
# (hash) |
|
What character is used to pad from the left with zeros (instead of spaces)? |
0 (zero) |
|
What is used to print a single literal '%'? |
%% |
|
What represents a mapping variable (dictionary arguments)? |
(var) |
|
Symbol where minimum total width is ____ and the number of digits to display after the decimal point is ____. |
m.n. |
|
What method capitalizes the first letter of a string? |
capitalize() |
|
What method returns a space-padded string with the original string centered to a total of "width" columns? |
center(width, fillchar) |
|
What method counts how many times 'str' occurs in string or in a substring of string if starting index beg and ending index end are given? |
count(str, beg= 0,end=len(string)) |
|
What method decodes the string using the codec registered for encoding. Encoding defaults to the default string encoding? |
decode(encoding='UTF-8',errors='strict') |
|
What method returns encoded string version of string; on error, default is to raise a ValueError unless errors is given with 'ignore' or 'replace'? |
encode(encoding='UTF-8',errors='strict') |
|
What method determines if string or a substring of string (if starting index beg and ending index end are given) ends with suffix; returns true if so and false otherwise? |
endswith(suffix, beg=0, end=len(string)) |
|
What method expands tabs in string to multiple spaces; defaults to 8 spaces per tab if tabsize not provided? |
expandtabs(tabsize=8) |
|
What method determine if 'str' occurs in string or in a substring of string; if starting index beg and ending index end are given returns index if found and -1 otherwise? |
find(str, beg=0 end=len(string)) |
|
What method determine if 'str' occurs in string or in a substring of string, but raises an exception if 'str' not found? |
index(str, beg=0, end=len(string)) |
|
What method returns true if string has at least 1 character and all characters are alphanumeric, and false otherwise? |
isalnum() |
|
What method returns true if string has at least 1 character and all characters are alphabetic and false otherwise? |
isalpha() |
|
What method returns true if string contains only digits and false otherwise? |
isdigit() |
|
What method returns true if string has at least 1 cased character and all cased characters are in lowercase and false otherwise? |
islower() |
|
What method returns true if a unicode string contains only numeric characters and false otherwise? |
isnumeric() |
|
What method returns true if string contains only whitespace characters and false otherwise? |
isspace() |
|
What method returns true if string is properly "titlecased" and false otherwise? |
istitle() |
|
What method returns true if string has at least one cased character and all cased characters are in uppercase and false otherwise? |
isupper() |
|
What method merges (concatenates) the string representations of elements in sequence 'seq' into a string, with separator 'string'? |
join(seq) |
|
What method returns the length of the string? |
len(string) |
|
What method returns a space-padded string with the original string left-justified to a total of 'width' columns? |
ljust(width[, fillchar]) |
|
What method converts all uppercase letters in string to lowercase? |
lower() |
|
What method removes all leading whitespace in string? |
lstrip() |
|
What method returns a translation table to be used in translate function? |
maketrans() |
|
What method returns the max alphabetical character from the string 'str'? |
max(str) |
|
What method returns the min alphabetical character from the string 'str'? |
min(str) |
|
What method replaces all occurrences of 'old' in string with 'new', or at most 'max' occurrences if 'max' given? |
replace(old, new [, max]) |
|
What method determines if 'str' occurs in string or in a substring of string, but searchbackwards in string? |
rfind(str, beg=0,end=len(string)) |
|
What method determines if 'str' occurs in string or in a substring of string and raises an exception if 'str' not found, but search backwards in string? |
rindex(str, beg=0, end=len(string)) |
|
What method returns a space-padded string with the original string right-justified to a total of 'width' columns? |
rjust(width,[, fillchar]) |
|
What method removes all trailing whitespace of string? |
strip() |
|
What method splits string according to delimiter 'str' (space if notprovided) and returns list of substrings; split into at most 'num' substrings if given? |
split(str="", num=string.count(str)) |
|
What method splits string at all (or 'num') NEWLINEs and returns a list ofeach line with NEWLINEs removed? |
splitlines(num=string.count('\n')) |
|
What method determines if string or a substring of string (if starting index beg and ending index end are given) starts with substring 'str'; returns true if so and false otherwise? |
startswith(str, beg=0,end=len(string)) |
|
What method removes all leading and trailing whitespace of a string? |
strip([chars]) |
|
What method inverts case for all letters in string? |
swapcase() |
|
What method returns "titlecased" version of string, that is, all words begin with uppercase and the rest are lowercase? |
title() |
|
What method translates string according to translation table str(256 chars), removing those in the del string? |
translate(table, deletechars="") |
|
What method converts lowercase letters in string to uppercase? |
upper() |
|
What method returns original string leftpadded with zeros to a total of 'width' characters; intended for numbers, it retains any sign given (less one zero)? |
zfill(width) |
|
What method returns true if a unicode string contains only decimal characters and false otherwise? |
isdecimal() |