YUNOVA · Python programming
Module 6: Strings
Python me string slicing
Key points
- String पर भी slicing वैसे ही चलती है जैसे list पर।
- हर अक्षर का अपना index होता है और गिनती 0 से शुरू होती है।
- उल्टा करने के लिए step में -1 दिया जाता है।
Python me string methods - upper, lower, strip, replace
Key points
- upper() सब बड़े अक्षर कर देता है और lower() सब छोटे।
- strip() आगे-पीछे की फ़ालतू space हटाता है, जो input लेते समय काम आता है।
- replace() एक शब्द की जगह दूसरा रख देता है।
Python me split() aur join()
Key points
- split() एक string को टुकड़ों की list बना देता है।
- बिना कुछ दिए यह space पर तोड़ता है; comma देकर comma पर।
- join() इसका उल्टा है: टुकड़ों को जोड़कर एक string बनाता है।