Skip to content

Instantly share code, notes, and snippets.

View amanrocks11's full-sized avatar
🎯
Focusing

Aman Srivastava amanrocks11

🎯
Focusing
  • Twilio
  • Bangalore
View GitHub Profile
  1. To check if the substring exists -> .find(sub_string) || .find(sub_string, start_pos, end_pos) Returns -1 if substring does not exists.
  2. This method checks if all the characters of a string are alphanumeric (a-z, A-Z and 0-9). -> str.isalnum()
  3. Swap cases. Will swap cases in the string. -> s.swapcase()
  4. Join the string back -> string = ''.join(l) l can be any iteratable DS like a list.
  5. This method checks if all the characters of a string are digits (0-9)/alphabetical (a-z and A-Z). -> str.isdigit() || str.isalpha()
  6. This method checks if all the characters of a string are lowercase/uppercase characters -> str.islower() || **[str.isupper()](https://docs.python.org/2/library/stdtypes