Table of Contents
Python Pre-define function
String Predefine function
Method | Description |
---|---|
abs() | This method is used to the absolute value of a number. |
add() | This method is used to Adds an element to the set. |
all() | This method is used to if all items in an iterable object are true returns True otherwise False. |
any() | This method is used to if any item in an iterable object is true returns True otherwise False. |
append() | This method is used to Adds an element at the end of the list. |
ascii() | This method is used to a readable version of an object. Replaces none-ascii characters with escape character. |
bin() | This method is used to the binary version of a number. |
bool() | This method is used to the Boolean value of the specified object. |
bytearray() | This method is used to an array of bytes. |
bytes() | This method is used to a bytes object. |
callable() | This method is used to if the specified object is callable, returns True otherwise False. |
capitalize() | This method is used to Converts the first character into upper case. |
casefold() | This method is used to Converts string into lower case. |
center() | This method is used to Return a centered string. |
chr() | This method is used to a character from the specified Unicode code. |
classmethod() | This method is used to Converts a method into a class method |
clear() | This method is used to Removes all the elements from the list. |
clear() | This method is used to Removes all the elements from the dictionary. |
clear() | This method is used to Removes all the elements from the set. |
close() | This method is used to Closes the file. |
compile() | This method is used to the specified source as an object, ready to be executed. |
complex() | This method is used to Returns a complex number. |
copy() | This method is used to Returns a copy of the list. |
copy() | This method is used to Returns a copy of the dictionary. |
copy() | This method is used to Returns a copy of the set. |
count() | This method is used to Return the number of times a specified value occurs in a string. |
count() | This method is used to Returns the number of elements with the specified value. |
count() | This method is used to Returns the number of times a specified value occurs in a tuple. |
delattr() | This method is used to Deletes the specified attribute (property or method) from the specified object. |
detach() | This method is used to Returns the separated raw stream from the buffer. |
dict() | This method is used to Returns a dictionary (Array). |
difference() | This method is used to Returns a set containing the difference between two or more sets. |
difference_update() | This method is used to Removes the items in this set that are also included in another, specified set. |
dir() | This method is used to Returns a list of the specified object's properties and methods. |
discard() | This method is used to Remove the specified item. |
divmod() | This method is used to Returns the quotient and the remainder when argument1 is divided by argument2. |
encode() | This method is used to Return an encoded version of the string. |
endswith() | This method is used to Return true if the string ends with the specified value. |
enumerate() | This method is used to Takes a collection (e.g. a tuple) and returns it as an enumerate object. |
eval() | This method is used to Evaluates and executes an expression. |
exec() | This method is used to Executes the specified code (or object). |
expandtabs() | This method is used to Set the tab size of the string. |
extend() | This method is used to Add the elements of a list (or any iterable), to the end of the current list. |
fileno() | This method is used to Returns a number that represents the stream, from the operating system's perspective. |
filter() | This method is used to Use a filter function to exclude items in an iterable object. |
find() | This method is used to searches the string for a specified value and return the position of where item was found. |
float() | This method is used to Returns a floating point number. |
flush() | This method is used to Flushes the internal buffer. |
format() | This method is used to Format specified values in a string. |
format() | This method is used to Formats a specified value. |
format_map() | This method is used to format specified values in a string. |
fromkeys() | This method is used to Returns a dictionary with the specified keys and value. |
frozenset() | This method is used to Returns a frozen set object. |
get() | This method is used to Returns the value of the specified key. |
getattr() | This method is used to Returns the value of the specified attribute (property or method). |
globals() | This method is used to Returns the current global symbol table as a dictionary. |
hasattr() | This method is used to Returns True if the specified object has the specified attribute (property/method). |
hash() | This method is used to Returns the hash value of a specified object. |
help() | This method is used to Executes the built-in help system. |
hex() | This method is used to Converts a number into a hexadecimal value. |
id() | This method is used to Returns the id of an object. |
index() | This method is used to searches the string then returns the position of where it was found. |
index() | This method is used to Returns the index of the first element with the specified value. |
index() | This method is used to Searches the tuple for a specified value and returns the position of where it was found. |
input() | This method is used to Allowing user input. |
insert() | This method is used to Adds an element at the specified position. |
int() | This method is used to Returns an integer number. |
intersection() | This method is used to Returns a set, that is the intersection of two or more sets. |
intersection_update() | This method is used to Removes the items in this set that are not present in other, specified set(s). |
isalnum() | This method is used if all characters in the string are alphanumeric it return True. |
isalpha() | This method is used if all characters in the string are in the alphabet it Returns True otherwise returns false. |
isascii() | This method is used if all characters in the string are ASCII characters it Returns True otherwise returns false. |
isatty() | This method is used to Returns whether the file stream is interactive or not. |
isdecimal() | This method is used if all characters in the string are decimals Returns True otherwise returns false. |
isdigit() | This method is used if all characters in the string are digits Returns True otherwise returns false. |
isdisjoint() | This method is used to Returns whether two sets have a intersection or not. |
isidentifier() | This method is used if the string is an identifier Returns True |
isinstance() | This method is used to Returns True if a specified object is an instance of a specified object. |
islower() | This method is used if all characters in the string are lower case Returns True otherwise return false. |
isnumeric() | This method is used if all characters in the string are numeric Returns True otherwise return false. |
isprintable() | This method is used if all characters in the string are printable Returns True otherwise return false. |
isspace() | This method is used if all characters in the string are whitespaces Returns True otherwise return false. |
issubclass() | This method is used to Returns True if a specified class is a subclass of a specified object. |
issubset() | This method is used to Returns whether another set contains this set or not. |
issuperset() | This method is used to Returns whether this set contains another set or not. |
istitle() | This method is used if the string follows the rules of a title Returns True otherwise return false. |
isupper() | This method is used if all characters in the string are upper case Returns True otherwise return false. |
items() | This method is used to Returns a list containing a tuple for each key value pair. |
iter() | This method is used to Returns an iterator object. |
join() | This method is used to Converts the elements of an iterable into a string. |
keys() | This method is used to Returns a list containing the dictionary's keys. |
len() | This method is used to Returns the length of an object. |
list() | This method is used to Returns a list. |
ljust() | This method is used to a left justified version of the string. |
locals() | This method is used to Returns an updated dictionary of the current local symbol table. |
lower() | This method is used to Converts a string into lower case. |
lstrip() | This method is used to a left trim version of the string. |
maketrans() | This method is used to a translation table to be used in translations. |
map() | This method is used to Returns the specified iterator with the specified function applied to each item. |
max() | This method is used to Returns the largest item in an iterable. |
memoryview() | This method is used to Returns a memory view object. |
min() | This method is used to Returns the smallest item in an iterable. |
next() | This method is used to Returns the next item in an iterable. |
object() | This method is used to Returns a new object. |
oct() | This method is used to Converts a number into an octal. |
open() | This method is used to Opens a file and returns a file object. |
ord() | This method is used to Convert an integer representing the Unicode of the specified character. |
partition() | This method is used a tuple where the string is parted into three parts. |
pop() | This method is used to Removes the element at the specified position. |
pop() | This method is used to Removes the element with the specified key. |
pop() | This method is used to Removes an element from the set. |
popitem() | This method is used to Removes the last inserted key-value pair. |
pow() | This method is used to Returns the value of x to the power of y. |
print() | This method is used to Prints to the standard output device. |
property() | This method is used to Gets, sets, deletes a property. |
range() | This method is used to Returns a sequence of numbers, starting from 0 and increments by 1 (by default). |
read() | This method is used to Returns the file content. |
readable() | This method is used to Returns whether the file stream can be read or not. |
readline() | This method is used to Returns one line from the file. |
readlines() | This method is used to Returns a list of lines from the file. |
remove() | This method is used to Removes the first item with the specified value. |
remove() | This method is used to Removes the specified element. |
replace() | This method is used to a string where a specified value is replaced with a specified value. |
repr() | This method is used to Returns a readable version of an object. |
reverse() | This method is used to Reverses the order of the list. |
reversed() | This method is used to Returns a reversed iterator. |
rfind() | This method is used to Searches the string for a specified value and returns the last position of where it was found. |
rindex() | This method is used to Searches the string for a specified value and returns the last position of where it was found. |
rjust() | This method is used to a right justified version of the string. |
round() | This method is used to Rounds a numbers. |
rpartition() | This method is used a tuple where the string is parted into three parts. |
rsplit() | This method is used to Splits the string at the specified separator, and returns a list. |
rstrip() | This method is used a right trim version of the string. |
seek() | This method is used to Change the file position. |
seekable() | This method is used to Returns whether the file allows us to change the file position. |
set() | This method is used to Returns a new set object. |
setattr() | This method is used to Sets an attribute (property/method) of an object. |
setdefault() | This method is used to Returns the value of the specified key. If the key does not exist: insert the key, with the specified value. |
slice() | This method is used to Returns a slice object. |
sort() | This method is used to Sorts the list |
sorted() | This method is used to Returns a sorted list. |
split() | This method is used Splits the string at the specified separator, and returns a list. |
splitlines() | This method is used to Splits the string at line breaks and returns a list. |
startswith() | This method is used to if the string starts with the specified value Returns true otherwise it returns false. |
staticmethod() | This method is used to Converts a method into a static method. |
str() | This method is used to Returns a string object. |
strip() | This method is used to a trimmed version of the string. |
sum() | This method is used to Sums the items of an iterator. |
super() | This method is used to Returns an object that represents the parent class. |
swapcase() | This method is used to Swaps cases, lower case becomes upper case and vice versa. |
symmetric_difference() | This method is used to Returns a set with the symmetric differences of two sets. |
symmetric_difference_update() | This method is used to inserts the symmetric differences from this set and another. |
tell() | This method is used to Returns the current file position. |
title() | bjbj |
translate() | This method is used to a translated string |
truncate() | This method is used to Resizes the file to a specified size. |
tuple() | This method is used to Returns a tuple. |
type() | This method is used to Returns the type of an object. |
union() | This method is used to Return a set containing the union of sets. |
update() | This method is used to Updates the dictionary with the specified key-value pairs. |
update() | This method is used to Update the set with another set, or any other iterable. |
upper() | This method is used to Converts a string into upper case. |
values() | This method is used to Returns a list of all the values in the dictionary. |
vars() | This method is used to Returns the __dict__ property of an object. |
writable() | This method is used to Returns whether the file can be written to or not. |
write() | This method is used to Writes the specified string to the file. |
writelines() | This method is used to Writes a list of strings to the file. |
zfill() | This method is used to Fills the string with a specified number of 0 values at the beginning. |
zip() | This method is used to Returns an iterator, from two or more iterators. |
strip( ) function
This method removes any whitespace from the beginning or the end.
a = " Hello,NIELITBHU World! "
print(a.strip())
Output
Hello,NIELITBHU World!
len( ) function
The len( ) method returns the length of a string,tuple,list,sets,Dictionary.
a = "Hi,NIELITBHU"
print(len(a))
Output
12
lower( ) function
The lower( ) method returns the string in lower case.
a = "Hi,NIELITBHU"
print(a.lower())
Output
hi,nielitbhu
upper( ) function
The upper( ) method returns the string in the upper case.
a = "hi,nielitbhu"
print(a.upper())
Output
HI,NIELITBHU
replace( ) function
The replace( ) method replaces a string with another string.
a = "hi,nielitbhu"
print(a.replace("h", "#"))
Output
#i,nielitb#u
split( ) function
The split( ) method splits.
a = "hi,nielit,bhu"
print(a.split(","))
Output
[‘hi’, ‘nielit’, ‘bhu’]