Copyright (c) Hyperion Entertainment and contributors.

AmigaOS Manual: Python Methods

From AmigaOS Documentation Wiki
Jump to navigation Jump to search

Built-in Methods for Strings

.capitalize()

stringobject.capitalize()

Returns a string where the first character is upper case.

Example

Uppercase the first letter in sentence "python for everybody.":

text = "python for everybody."
txt = text.capitalize()
print( txt )

.center()

stringobject.center(width, fillchar)

.count()

stringobject.count(substring, start, end)

.decode()

stringobject.decode(encoding, errors)

.encode()

stringobject.encode(encoding, errors)

.endswith()

stringobject.endswith(suffix, start, end)

.expandtabs()

stringobject.expandtabs(tabsize)

.find()

stringobject.find(string, start, end)

.index()

stringobject.index(string, start, end)

.isalnum()

stringobject.isalnum()

.isalpha()

stringobject.isalpha()

.isdecimal()

stringobject.isdecimal()

.isdigit()

stringobject.isdigit()

Returns true if the string stringobject contains only digits.

.islower()

stringobject.islower()

.isnumeric()

stringobject.isnumeric()

.isspace()

stringobject.isspace()

.istitle()

stringobject.istitle()

.isupper()

stringobject.isupper()

.join()

stringobject.join(sequence)

.len()

stringobject.len()

Returns the length of the string stringobject.

.ljust()

stringobject.ljust(width[, fillchar])

.lower()

stringobject.lower()

.lstrip()

stringobject.lstrip()

.maketrans()

stringobject.maketrans()

.max()

stringobject.max(string)

.min()

stringobject.min(string)

.replace()

stringobject.replace(old, new[, max])

.rfind()

stringobject.rfind(string, start, end)

.rindex()

stringobject.rindex(string, start, end)

.rjust()

stringobject.rjust(width[, fillchar])

.rstrip()

stringobject.rstrip()

.split()

stringobject.split(delimiter, splits)

.splitlines()

stringobject.splitlines([keeplinebreaks])

Splits the string stringobject into a list. The splitting is done at line breaks. The optional parameter keeplinebreaks specifies if the line breaks should be included (True), or not (False). Default value is False

.startswith()

stringobject.startswith(string, start, end)

.strip()

stringobject.strip(characters)

.swapcase()

stringobject.swapcase()

.title()

object.title()

.translate()

stringobject.translate(translationtable[, deletechars])

.upper()

stringobject.upper()

.zfill()

stringobject.zfill(width)

Built-in Methods for Lists

.append()

.count()

.extend()

.index()

.insert()

.pop()

.remove()

.reverse()

.sort()

Built-in Methods for Sets

.add()

.clear()

.copy()

.difference()

.difference_update()

.discard()

.intersection()

.intersection_update()

.isdisjoint()

.issubset()

.pop()

.remove()

.symmetric_difference()

.symmetric_difference_update()

.union()

.update()

Built-in Methods for Dictionaries

.clear()

.copy()

.fromkeys()

.get()

.has_key()

.items()

.keys()

.setdefault()

.update()

.values()