# fetching lyrics
import requests
url = 'https://song.panditsiddharth.repl.co/lyrics?song=har+har+shambhu'
lyrics = requests.get(url).text
print(lyrics)
import requests
url = 'https://song.panditsiddharth.repl.co/lyrics?song=har+har+shambhu'
lyrics = requests.get(url).text
print(lyrics)
String functions
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
@python_codes_pro
1.
len(str): Returns the length of the string.2.
str.lower(): Returns a copy of the string in lowercase.3.
str.upper(): Returns a copy of the string in uppercase.4.
str.capitalize(): Returns a copy of the string with the first character capitalized.5.
str.title(): Returns a copy of the string with the first character of each word capitalized.6.
str.strip(): Returns a copy of the string with leading and trailing whitespace removed.7.
str.startswith(prefix): Returns True if the string starts with the specified prefix; otherwise, returns False.8.
str.endswith(suffix): Returns True if the string ends with the specified suffix; otherwise, returns False.9.
str.format(*args, **kwargs): Formats the string by replacing placeholders with provided values.10.
str.replace(old, new): Returns a copy of the string with all occurrences of old replaced by new.11.
str.split(sep=" "): Splits the string into a list of substrings based on the specified separator sep (default is space).12.
str.join(iterable): Concatenates elements of the iterable sequence into a single string using str as the separator.13.
str.isdigit(): Returns True if all characters in the string are digits; otherwise, returns False.14.
str.isalpha(): Returns True if all characters in the string are alphabetic; otherwise, returns False.15.
str.isnumeric(): Returns True if all characters in the string are numeric; otherwise, returns False.@python_codes_pro
👍5❤4
# fetch song lyrics
url = "https://song.panditsiddharth.repl.co/lyrics?song=ae+watan"
import requests as r
print(r.get(url).text)
# @Python_Codes_Pro
url = "https://song.panditsiddharth.repl.co/lyrics?song=ae+watan"
import requests as r
print(r.get(url).text)
# @Python_Codes_Pro
# fetch song link with title
song = "ae watan"
url = "https://song.panditsiddharth.repl.co/song?song=" + song
import requests as r
print(r.get(url).text)
# @Python_Codes_Pro
song = "ae watan"
url = "https://song.panditsiddharth.repl.co/song?song=" + song
import requests as r
print(r.get(url).text)
# @Python_Codes_Pro
# Run and see its output
message = chr(32) + chr(72) + chr(97) + chr(112) + chr(112) + chr(121) + chr(32) + chr(73) + chr(110) + chr(100) + chr(101) + chr(112) + chr(101) + chr(110) + chr(100) + chr(101) + chr(110) + chr(99) + chr(101) + chr(32) + chr(100) + chr(97) + chr(121) + chr(33)
print('\U0001F1EE\U0001F1F3' + message)
# @python_codes_pro
message = chr(32) + chr(72) + chr(97) + chr(112) + chr(112) + chr(121) + chr(32) + chr(73) + chr(110) + chr(100) + chr(101) + chr(112) + chr(101) + chr(110) + chr(100) + chr(101) + chr(110) + chr(99) + chr(101) + chr(32) + chr(100) + chr(97) + chr(121) + chr(33)
print('\U0001F1EE\U0001F1F3' + message)
# @python_codes_pro
😁4👍1
❤3
# 2. str.lower():
my_string = "Hello, World!"
lowercase_string = my_string.lower()
print(lowercase_string)
# @Python_Codes_Pro
my_string = "Hello, World!"
lowercase_string = my_string.lower()
print(lowercase_string)
# @Python_Codes_Pro
# 3. str.upper():
my_string = "Hello, World!"
uppercase_string = my_string.upper()
print(uppercase_string)
# @python_codes_pro
my_string = "Hello, World!"
uppercase_string = my_string.upper()
print(uppercase_string)
# @python_codes_pro
# 4. str.capitalize():
my_string = "hello, world!"
capitalized_string = my_string.capitalize()
print(capitalized_string)
# @python_codes_pro
my_string = "hello, world!"
capitalized_string = my_string.capitalize()
print(capitalized_string)
# @python_codes_pro
# 5. str.title():
my_string = "hello, world!"
title_case_string = my_string.title()
print(title_case_string)
# @python_codes_pro
my_string = "hello, world!"
title_case_string = my_string.title()
print(title_case_string)
# @python_codes_pro
❤1
# 6. str.strip():
my_string = " Hello, World! "
stripped_string = my_string.strip()
print(stripped_string)
# @python_codes_pro
my_string = " Hello, World! "
stripped_string = my_string.strip()
print(stripped_string)
# @python_codes_pro
# 7. str.startswith(prefix):
my_string = "Hello, World!"
starts_with_hello = my_string.startswith("Hello")
print(starts_with_hello)
# @python_codes_pro
my_string = "Hello, World!"
starts_with_hello = my_string.startswith("Hello")
print(starts_with_hello)
# @python_codes_pro
# 8. str.endswith(suffix):
my_string = "Hello, World!"
ends_with_world = my_string.endswith("World!")
print(ends_with_world)
# @python_codes_pro
my_string = "Hello, World!"
ends_with_world = my_string.endswith("World!")
print(ends_with_world)
# @python_codes_pro
# 9. str.format(*args, **kwargs):
name = "Alice"
age = 25
formatted_string = "My name is {} and I'm {} years old.".format(name, age)
print(formatted_string)
# @python_codes_pro
name = "Alice"
age = 25
formatted_string = "My name is {} and I'm {} years old.".format(name, age)
print(formatted_string)
# @python_codes_pro
# 10. str.replace(old, new):
my_string = "Hello, World!"
new_string = my_string.replace("Hello", "Hi")
print(new_string)
# @python_codes_pro
my_string = "Hello, World!"
new_string = my_string.replace("Hello", "Hi")
print(new_string)
# @python_codes_pro
# 11. str.split(sep=" "):
my_string = "Hello, World!"
words = my_string.split()
print(words)
# @python_codes_pro
my_string = "Hello, World!"
words = my_string.split()
print(words)
# @python_codes_pro