Friday, 15 December 2023

Handling Strings

 /* Attributes starting with underscores are often considered private in Python for Dir() method, and this condition is used to filter out private attributes which starts with __(underscore).

text = Python

 >>> print(dir(text))

Use the Dir() function to list all the methods and attributes of the python Object.

print(help(text.startswith))    -- It will tell how to use the String method.

text = Python

>>> for method in dir(text):
...     if method.startswith("_")  :
...         continue
...     print(method)
capitalize
casefold
center
count

No comments:

Post a Comment

SQL -

 Window Functions -  Window function: pySpark window functions are useful when you want to examine relationships within group of data rather...