Python

python methods

Laten we beginnen. Het is Gratis
of registreren met je e-mailadres
Python Door Mind Map: Python

1. format()

1.1. string.format(value1, value2...)

1.1.1. method formats the specified value(s) and insert them inside the string's placeholder

2. replace()

2.1. string.replace(oldvalue, newvalue, count)

2.1.1. method replaces a specified phrase with another specified phrase

3. swapcase()

3.1. No parameters

3.1.1. method returns a string where all the upper case letters are lower case and vice versa

4. title()

4.1. No parameters

4.1.1. method returns a string where the first character in every word is upper case. Like a header, or a title

5. isalnum()

5.1. No parameters

5.1.1. method returns True if all the characters are alphanumeric, meaning alphabet letter (a-z) and numbers (0-9)

6. istitle()

6.1. No parameters

6.1.1. method returns True if all words in a text start with a upper case letter, AND the rest of the word are lower case letters, otherwise False

7. isspace()

7.1. No parameters

7.1.1. method returns True if all the characters in a string are whitespaces, otherwise False

8. isidentifier()

8.1. No parameters

8.1.1. method returns True if the string is a valid identifier, otherwise False

9. isalpha()

9.1. No parameters

9.1.1. method returns True if all the characters are alphabet letters (a-z). Example of characters that are not alphabet letters: (space)!#%&? etc

10. capitalize()

10.1. No parameters

10.1.1. method returns a string where the first character is upper case, and the rest is lower case

11. isupper()

11.1. No parameters

11.1.1. method returns True if all the characters are in upper case, otherwise False

12. islower()

12.1. No parameters

12.1.1. method returns True if all the characters are in lower case, otherwise False

13. upper()

13.1. No parameters

13.1.1. method returns a string where all characters are in upper case.

14. lower()

14.1. No parameters

14.1.1. method returns a string where all characters are lower case

15. casefold()

15.1. No parameters

15.1.1. method returns a string where all the characters are lower case

16. Python Methods

17. join()

17.1. string.join(iterable)

17.1.1. method takes all items in an iterable and joins them into one string

18. center()

18.1. string.center(length, character)

18.1.1. method will center align the string, using a specified character (space is default) as the fill character

19. count()

19.1. string.count(value, start, end)

19.1.1. method returns the number of times a specified value appears in the string

20. zfill()

20.1. string.zfill(len)

20.1.1. method adds zeros (0) at the beginning of the string, until it reaches the specified length

21. rsplit()

21.1. string.rsplit(separator, maxsplit)

21.1.1. method splits a string into a list, starting from the right

22. split()

22.1. string.split(separator, maxsplit)

22.1.1. method splits a string into a list. You can specify the separator, default separator is any white space

23. rindex()

23.1. string.rindex(value, start, end)

23.1.1. Searches the string for a specified value and returns the last position of where it was found

24. rfind()

24.1. string.rfind(value, start, end)

24.1.1. Searches the string for a specified value and returns the last position of where it was found

25. lstrip()

25.1. string.rstrip(characters)

25.1.1. method removes any leading characters (space is the default leading character to remove)

26. rstrip()

26.1. string.rstrip(characters)

26.1.1. method removes any trailing characters (characters at the end a string), space is the default trailing character to remove

27. strip()

27.1. string.strip(characters)

27.1.1. method removes any leading (spaces at the beginning) and trailing (spaces at the end) characters (space is the default leading character to remove)

28. rjust()

28.1. string.ljust(length, character)

28.1.1. method will right align the string, using a specified character (space is default) as the fill characte

29. ljust()

29.1. string.ljust(length, character)

29.1.1. method will left align the string, using a specified character (space is default) as the fill character

30. endswith()

30.1. string.endswith(value, start, end)

30.1.1. method returns True if the string ends with the specified value, otherwise False.

31. index()

31.1. string.index(value, start, end)

31.1.1. Searches the string for a specified value and returns the position of where it was found

32. find()

32.1. string.find(value, start, end)

32.1.1. Searches the string for a specified value and returns the position of where it was found

33. startswith()

33.1. string.startswith(value, start, end)

33.1.1. method returns True if the string starts with the specified value, otherwise False.