substr()substr() extract substring strupper()strupper() convert to uppercase strlower() convert to lowercase strproper() convert to proper case strtrim()stritrim() replace multiple, consecutive internal blanks with one blank strltrim() remove leading blanks strrtrim() remove trailing blanks strtrim() remove leading and trailing blanks
<div dir="ltr" style="text-align: left;" trbidi="on"><span style="background-color: white; color: #555555; font-family: Arial, Helvetica, sans-serif; font-size: 12px ... Print Function and Strings. The print function in Python is a function that outputs to your console window whatever you say you want to print out. At first blush, it might appear that the print function is rather useless for programming, but it is actually one of the most widely used functions in all of python. Given a word the program outputs the length of the longest substring with the same letters. For example: long_repeat ('sdsffffse') == 4. long_repeat ('ddvvrwwwrggg') == 3. long_repeat ('abababaab') == 2. long_repeat ('') == 0.
I needed a version of the string.index(sub) function which returns a list of indices of ALL occurances of a substring in the string. Is there a better/shorter/more efficient way to do this? Please share.