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 :: invalid literal for int() with base 10 in python 
Python :: Python String count() example 
Python :: python read array line by line 
Python :: indent python code 
Python :: scapy python functions 
Python :: python lenght 
Python :: python number of specific characters in string 
Python :: turn list into string 
Python :: Python NumPy Reshape function example 
Python :: create a virtual environment python 3 
Python :: pip install module for specific python version 
Python :: python pandas how to check in what columns there are empty values(NaN) 
Python :: rstrip python3 
Python :: object has no attribute python 
Python :: python click activator 
Python :: speechapi 
Python :: pd column to one hot vector 
Python :: how do you make plot show with matplotlib ion method 
Python :: Python program for getting url, hostname, port numbers 
Python :: pandas math operation from string 
Python :: Second step creating python project 
Python :: how write a date with th and nd in python 
Python :: check package without importing it python 
Python :: init matrix in numpy 
Python :: Filter dataarray 
Python :: menampilkan data dalam range tertentu di python 
Python :: how to put quotes in string python 
Python :: how to use displacy 
Python :: reverse the order of list elements 
Python :: shorthand python if 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =