Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

title() function in python

# title() title function capitalises the first letter of string and make other 
# letter lower case.
a=input('Enter a string :')
b=a.title()
print(b,': is the modified string')
# output:
'''
Enter a string :hII hOW aRE yOU
Hii How Are You : is the modified string
'''
Comment

title() in python

>>> import re
>>> def titlecase(s):
...     return re.sub(rb"[A-Za-z]+('[A-Za-z]+)?",
...                   lambda mo: mo.group(0)[0:1].upper() +
...                              mo.group(0)[1:].lower(),
...                   s)
...
>>> titlecase(b"they're bill's friends.")
b"They're Bill's Friends."
Comment

python string: .title()

# .title() мөрийн арга нь гарчгийн том үсгийн мөрийг буцаана. 
# Гарчгийн том үсгээр үг бүрийн эхний тэмдэгтийг том үсгээр бичсэн бол бусад тэмдэгтүүдийг жижиг үсгээр бичнэ.

my_var = "dark knight"
print(my_var.title()) 
 
# Prints: Dark Knight
Comment

PREVIOUS NEXT
Code Example
Python :: space complexity python 
Python :: upgrade python version windows 
Python :: python tuple example 
Python :: pandas weighted average groupby 
Python :: issubclass python example 
Python :: is login a class in python 
Python :: python list equality 
Python :: pivot table pandas 
Python :: time conversion 
Python :: tensorflow data augmentation 
Python :: python remove the element in list 
Python :: comentar codigo en python 
Python :: how to schedule python script in windows 
Python :: python class getters and setters 
Python :: Reverse an string Using Reversed function 
Python :: python 2d array 
Python :: print list of list line by line python 
Python :: python how to create a class 
Python :: how to convert time from one timezone to another in python 
Python :: python in line elif 
Python :: Remove an element from a Python list Using pop() method 
Python :: np.transpose(x) array([[0, 2], [1, 3]]) 
Python :: matplotlib matshow log scale 
Python :: python package install 
Python :: @property python 
Python :: Example 1: Reset Index & Drop Old Index pandas 
Python :: dockerfile example 
Python :: how to add number in tuple 
Python :: get element by index in list python 
Python :: how to make a modulo in python 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =