String
Conversion between string and list
- join() : If use join on a list with only numeric elements, TypeError because the + operator is not defined for combining a list and an integer other functions
The dir() function in Python returns all of the object’s properties and methods, but not their values1. When you call dir(string), it returns a list of valid attributes and methods that can be used with the string object. Operation in the stings
same to list, if string multipled by negative numbers or zero, it returns a empty string. if string multipled by floats, error |
Common Functions
isnumeric() checks for a broader range of numeric characters, including those from other scripts, while isdecimal() only recognizes decimal digits. Neither method recognizes decimal numbers or fractions. Espace Sequence
help us differentiate between characters that have a special meaning in the programming language and characters that are part of the string itself. If a string contain \n in the text, \\n to distinguish newline charchater and text \n. Except for \' and \", we can also use single/double quote to distinguish quote in text. \r idem chapter 7 |
Cheatography
https://cheatography.com
Chap_10 Cheat Sheet by Theo666
strings in Python are iterable, indexable and immutable (id)
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by Theo666