Copyright (c) Hyperion Entertainment and contributors.

Difference between revisions of "AmigaOS Manual: Python Methods"

From AmigaOS Documentation Wiki
Jump to navigation Jump to search
m
Line 3: Line 3:
 
== .capitalize() ==
 
== .capitalize() ==
   
<nowiki>object.capitalize()</nowiki>
+
<nowiki>stringobject.capitalize()</nowiki>
   
 
Returns a string where the first character is upper case.
 
Returns a string where the first character is upper case.
Line 17: Line 17:
 
== .center() ==
 
== .center() ==
   
<nowiki>object.center(width, fillchar)</nowiki>
+
<nowiki>stringobject.center(width, fillchar)</nowiki>
   
 
== .count() ==
 
== .count() ==
   
<nowiki>object.count(substring, start, end)</nowiki>
+
<nowiki>stringobject.count(substring, start, end)</nowiki>
   
 
== .decode() ==
 
== .decode() ==
   
<nowiki>object.decode(encoding, errors)</nowiki>
+
<nowiki>stringobject.decode(encoding, errors)</nowiki>
   
 
== .encode() ==
 
== .encode() ==
   
<nowiki>object.encode(encoding, errors)</nowiki>
+
<nowiki>stringobject.encode(encoding, errors)</nowiki>
   
 
== .endswith() ==
 
== .endswith() ==
   
<nowiki>object.endswith(suffix, start, end)</nowiki>
+
<nowiki>stringobject.endswith(suffix, start, end)</nowiki>
   
 
== .expandtabs() ==
 
== .expandtabs() ==
   
<nowiki>object.expandtabs(tabsize)</nowiki>
+
<nowiki>stringobject.expandtabs(tabsize)</nowiki>
   
 
== .find() ==
 
== .find() ==
   
<nowiki>object.find(string, start, end)</nowiki>
+
<nowiki>stringobject.find(string, start, end)</nowiki>
   
 
== .index() ==
 
== .index() ==
   
<nowiki>object.index(string, start, end)</nowiki>
+
<nowiki>stringobject.index(string, start, end)</nowiki>
   
 
== .isalnum() ==
 
== .isalnum() ==
   
<nowiki>object.isalnum()</nowiki>
+
<nowiki>stringobject.isalnum()</nowiki>
   
 
== .isalpha() ==
 
== .isalpha() ==
   
<nowiki>object.isalpha()</nowiki>
+
<nowiki>stringobject.isalpha()</nowiki>
   
 
== .isdecimal() ==
 
== .isdecimal() ==
   
<nowiki>object.isdecimal()</nowiki>
+
<nowiki>stringobject.isdecimal()</nowiki>
   
 
== .isdigit() ==
 
== .isdigit() ==
   
<nowiki>object.isdigit()</nowiki>
+
<nowiki>stringobject.isdigit()</nowiki>
   
Returns true if the string '''object''' contains only digits.
+
Returns true if the string '''stringobject''' contains only digits.
   
 
== .islower() ==
 
== .islower() ==
   
<nowiki>object.islower()</nowiki>
+
<nowiki>stringobject.islower()</nowiki>
   
 
== .isnumeric() ==
 
== .isnumeric() ==
   
<nowiki>object.isnumeric()</nowiki>
+
<nowiki>stringobject.isnumeric()</nowiki>
   
 
== .isspace() ==
 
== .isspace() ==
   
<nowiki>object.isspace()</nowiki>
+
<nowiki>stringobject.isspace()</nowiki>
   
 
== .istitle() ==
 
== .istitle() ==
   
<nowiki>object.istitle()</nowiki>
+
<nowiki>stringobject.istitle()</nowiki>
   
 
== .isupper() ==
 
== .isupper() ==
   
<nowiki>object.isupper()</nowiki>
+
<nowiki>stringobject.isupper()</nowiki>
   
 
== .join() ==
 
== .join() ==
   
<nowiki>object.join(sequence)</nowiki>
+
<nowiki>stringobject.join(sequence)</nowiki>
   
 
== .len() ==
 
== .len() ==
   
<nowiki>object.len()</nowiki>
+
<nowiki>stringobject.len()</nowiki>
   
Returns the length of the string '''object'''.
+
Returns the length of the string '''stringobject'''.
   
 
== .ljust() ==
 
== .ljust() ==
   
<nowiki>object.ljust(width[, fillchar])</nowiki>
+
<nowiki>stringobject.ljust(width[, fillchar])</nowiki>
   
 
== .lower() ==
 
== .lower() ==
   
<nowiki>object.lower()</nowiki>
+
<nowiki>stringobject.lower()</nowiki>
   
 
== .lstrip() ==
 
== .lstrip() ==
   
<nowiki>object.lstrip()</nowiki>
+
<nowiki>stringobject.lstrip()</nowiki>
   
 
== .maketrans() ==
 
== .maketrans() ==
   
<nowiki>object.maketrans()</nowiki>
+
<nowiki>stringobject.maketrans()</nowiki>
   
 
== .max() ==
 
== .max() ==
   
<nowiki>object.max(string)</nowiki>
+
<nowiki>stringobject.max(string)</nowiki>
   
 
== .min() ==
 
== .min() ==
   
<nowiki>object.min(string)</nowiki>
+
<nowiki>stringobject.min(string)</nowiki>
   
 
== .replace() ==
 
== .replace() ==
   
<nowiki>object.replace(old, new[, max])</nowiki>
+
<nowiki>stringobject.replace(old, new[, max])</nowiki>
   
 
== .rfind() ==
 
== .rfind() ==
   
<nowiki>object.rfind(string, start, end)</nowiki>
+
<nowiki>stringobject.rfind(string, start, end)</nowiki>
   
 
== .rindex() ==
 
== .rindex() ==
   
<nowiki>object.rindex(string, start, end)</nowiki>
+
<nowiki>stringobject.rindex(string, start, end)</nowiki>
   
 
== .rjust() ==
 
== .rjust() ==
   
<nowiki>object.rjust(width[, fillchar])</nowiki>
+
<nowiki>stringobject.rjust(width[, fillchar])</nowiki>
   
 
== .rstrip() ==
 
== .rstrip() ==
   
<nowiki>object.rstrip()</nowiki>
+
<nowiki>stringobject.rstrip()</nowiki>
   
 
== .split() ==
 
== .split() ==
   
<nowiki>object.split(delimiter, splits)</nowiki>
+
<nowiki>stringobject.split(delimiter, splits)</nowiki>
   
 
== .splitlines() ==
 
== .splitlines() ==
   
<nowiki>object.splitlines([keeplinebreaks])</nowiki>
+
<nowiki>stringobject.splitlines([keeplinebreaks])</nowiki>
   
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
+
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() ==
 
== .startswith() ==
   
<nowiki>object.startswith(string, start, end)</nowiki>
+
<nowiki>stringobject.startswith(string, start, end)</nowiki>
   
 
== .strip() ==
 
== .strip() ==
   
<nowiki>object.strip(characters)</nowiki>
+
<nowiki>stringobject.strip(characters)</nowiki>
   
 
== .swapcase() ==
 
== .swapcase() ==
   
<nowiki>object.swapcase()</nowiki>
+
<nowiki>stringobject.swapcase()</nowiki>
   
 
== .title() ==
 
== .title() ==
Line 167: Line 167:
 
== .translate() ==
 
== .translate() ==
   
<nowiki>object.translate(translationtable[, deletechars])</nowiki>
+
<nowiki>stringobject.translate(translationtable[, deletechars])</nowiki>
   
 
== .upper() ==
 
== .upper() ==
   
<nowiki>object.upper()</nowiki>
+
<nowiki>stringobject.upper()</nowiki>
   
 
== .zfill() ==
 
== .zfill() ==
   
<nowiki>object.zfill(width)</nowiki>
+
<nowiki>stringobject.zfill(width)</nowiki>
   
 
= Built-in Methods for Lists =
 
= Built-in Methods for Lists =

Revision as of 17:12, 13 February 2021

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