Python Strings Tutorial: Slicing, f-strings and String Methods with Examples
Ravindra Bagale's Tip — Chala mitrano
Names, cities, product codes, email IDs — most raw data is text. Today we learn to cut, clean and format text. These same methods come back in pandas as .str methods.
Ravindra Bagale's Tip – चला मित्रांनो
नावं, शहरं, product codes, email IDs — बहुतेक raw data text असतो. आज text कापायला, साफ करायला आणि format करायला शिकू. हेच methods pandas मध्ये .str methods म्हणून परत येतात.
Ravindra Bagale's Tip – चलो दोस्तों
नाम, शहर, product codes, email IDs — ज़्यादातर raw data text होता है. आज text काटना, साफ़ करना और format करना सीखेंगे. यही methods pandas में .str methods बनकर वापस आते हैं.
What you will learn in this chapter
- How to create strings and join them
- Indexing and slicing to cut parts of text
- Cleaning methods: strip, lower, upper, replace
- split and join for lists of words
- f-strings to format money and messages
- How to check text with in, startswith and endswith
Practice data
All names, shops, banks, hospitals and amounts in this chapter are made up for learning. They are not real people or real company numbers.