Computer Science, asked by mohitmy8806, 9 months ago

Describe the following method trans.late(table, deletechars="")

Answers

Answered by rehmatsara
0

Explanation:

Jitni haseen ye mulakatein hain

Unse bhi pyari teri baatein hain

Baaton mein teri jo kho jaate hain

Aaun na hosh mein main kabhi

Baahon mein hai teri zindagi, haayeapka hi krlo jaaan

Answered by letmeanswer12
0

Python string method translate()

Explanation:

The Python Translate() string method returns a copy of the string in which all characters were translated using table optionally deleting all characters contained in the deletechars list.

  • Syntax - str.translate(table[, deletechars]);
  • Parameters  - (table) − To build a translation table, we can use the maketrans() helper function inside the string module.  (deletechars) − Set of characters from source string to be deleted.
  • Return Value - This method, a translated copy of the string is returned.

Example for replacing every vowel in a string by its vowel position

  • #!/usr/bin/python
  • intab = "aeiou"
  • outtab = "12345"
  • trantab = maketrans(intab, outtab)
  • str = "This is translate method example. ";
  • print str.translate(trantab)

The above program give the following result −

  • Th3s 3s tr1nsl1t2 m2th4d 2x1mpl2

Similar questions