Copyright (c) Hyperion Entertainment and contributors.
Difference between revisions of "AmigaOS Manual: Python Methods"
Jump to navigation
Jump to search
(Added list of sets methods) |
m |
||
Line 188: | Line 188: | ||
== .reverse() == |
== .reverse() == |
||
== .sort() == |
== .sort() == |
||
− | |||
− | = Built-in Methods for Dictionaries = |
||
− | == .clear() == |
||
− | == .copy() == |
||
− | == .fromkeys() == |
||
− | == .get() == |
||
− | == .has_key() == |
||
− | == .items() == |
||
− | == .keys() == |
||
− | == .setdefault() == |
||
− | == .update() == |
||
− | == .values() == |
||
= Built-in Methods for Sets = |
= Built-in Methods for Sets = |
||
Line 219: | Line 207: | ||
== .union() == |
== .union() == |
||
== .update() == |
== .update() == |
||
+ | |||
+ | = Built-in Methods for Dictionaries = |
||
+ | == .clear() == |
||
+ | == .copy() == |
||
+ | == .fromkeys() == |
||
+ | == .get() == |
||
+ | == .has_key() == |
||
+ | == .items() == |
||
+ | == .keys() == |
||
+ | == .setdefault() == |
||
+ | == .update() == |
||
+ | == .values() == |
Revision as of 16:52, 12 February 2021
Contents
- 1 Built-in Methods for Strings
- 1.1 .capitalize()
- 1.2 .center()
- 1.3 .count()
- 1.4 .decode()
- 1.5 .encode()
- 1.6 .endswith()
- 1.7 .expandtabs()
- 1.8 .find()
- 1.9 .index()
- 1.10 .isalnum()
- 1.11 .isalpha()
- 1.12 .isdecimal()
- 1.13 .isdigit()
- 1.14 .islower()
- 1.15 .isnumeric()
- 1.16 .isspace()
- 1.17 .istitle()
- 1.18 .isupper()
- 1.19 .join()
- 1.20 .len()
- 1.21 .ljust()
- 1.22 .lower()
- 1.23 .lstrip()
- 1.24 .maketrans()
- 1.25 .max()
- 1.26 .min()
- 1.27 .replace()
- 1.28 .rfind()
- 1.29 .rindex()
- 1.30 .rjust()
- 1.31 .rstrip()
- 1.32 .split()
- 1.33 .splitlines()
- 1.34 .startswith()
- 1.35 .strip()
- 1.36 .swapcase()
- 1.37 .title()
- 1.38 .translate()
- 1.39 .upper()
- 1.40 .zfill()
- 2 Built-in Methods for Lists
- 3 Built-in Methods for Sets
- 4 Built-in Methods for Dictionaries
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)