String Interpolation is a process substituting values of variables into placeholders in a string Few methods as follow: a. .format() = is for simple positional formatting that uses to substitute in place of braces {}. Example: >> print (‘Welcome to {}’.format(‘ Linux Tutorials’)) Welcome to Linux Tutorials >> title = “Linux Tutorials” >>> print(‘Welcome to…
Tag: string
Python>>String Methods
Here are some common String Methods or Attributes that you can use in modifying strings. Assuming x is the string: a. x.upper() – converts to upper case > x = ‘Free Linux Tutorials’ >>> x.upper() ‘FREE LINUX TUTORIALS’ >>> print(x) Free Linux Tutorials >>> y = x.upper() >>> print (y) FREE LINUX TUTORIALS b….
Python>>String Concatenation
String concatenation is simply adding strings together. Here are sample String Concatenation: Sample1: >> a = ‘Free’ >>> b = ‘Linux’ >>> c = ‘Tutorials’ >>> a + b + c ‘FreeLinuxTutorials’ >>> d = a + b + c >>> print (d) FreeLinuxTutorials >>> Sample2: >>> a = ‘Welcome’ >>> b = ‘to my’…