Copyright (c) Hyperion Entertainment and contributors.

AmigaOS Manual: Python Methods

From AmigaOS Documentation Wiki
Revision as of 16:52, 12 February 2021 by Janne Peräaho (talk | contribs)
Jump to navigation Jump to search

Built-in Methods for Strings

.capitalize()

object.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()

object.center(width, fillchar)

.count()

object.count(substring, start, end)

.decode()

object.decode(encoding, errors)

.encode()

object.encode(encoding, errors)

.endswith()

object.endswith(suffix, start, end)

.expandtabs()

object.expandtabs(tabsize)

.find()

object.find(string, start, end)

.index()

object.index(string, start, end)

.isalnum()

object.isalnum()

.isalpha()

object.isalpha()

.isdecimal()

object.isdecimal()

.isdigit()

object.isdigit()

Returns true if the string object contains only digits.

.islower()

object.islower()

.isnumeric()

object.isnumeric()

.isspace()

object.isspace()

.istitle()

object.istitle()

.isupper()

object.isupper()

.join()

object.join(sequence)

.len()

object.len()

Returns the length of the string object.

.ljust()

object.ljust(width[, fillchar])

.lower()

object.lower()

.lstrip()

object.lstrip()

.maketrans()

object.maketrans()

.max()

object.max(string)

.min()

object.min(string)

.replace()

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

.rfind()

object.rfind(string, start, end)

.rindex()

object.rindex(string, start, end)

.rjust()

object.rjust(width[, fillchar])

.rstrip()

object.rstrip()

.split()

object.split(delimiter, splits)

.splitlines()

object.splitlines([keeplinebreaks])

Splits the string object 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()

object.startswith(string, start, end)

.strip()

object.strip(characters)

.swapcase()

object.swapcase()

.title()

object.title()

.translate()

object.translate(translationtable[, deletechars])

.upper()

object.upper()

.zfill()

object.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()