मुख्य कंटेंट पर जाएं
Python String Methods in Hindi
PYTHON PROGRAMMING 7 मिनट पढ़ें 1 बार पढ़ा गया

Python String Methods in Hindi

Lavkush Chakrawarti

परिचय

String Methods क्या हैं?

Syntax

Python String Methods की सूची

1. Case Conversion Methods

2. Searching Methods

3. Replace & Remove Methods

4. Split & Join Methods

5. Trim Methods

6. Alignment Methods

7. Checking Methods

8. Formatting Methods

9. Prefix & Suffix Methods

सभी Methods की पूरी सूची

आगे इस Series में क्या होगा?

 

परिचय

Python में String सबसे अधिक उपयोग होने वाले Data Types में से एक है। String को खोजने (Search), बदलने (Replace), विभाजित (Split), जोड़ने (Join), साफ़ करने (Trim), जाँचने (Check) और Format करने के लिए Python अनेक Built-in String Methods प्रदान करता है।

ये Methods Programming, Web Development, Data Analysis, Automation, Competitive Programming तथा Interview Coding में सबसे अधिक उपयोग किए जाते हैं।

इस अध्याय में Python के 40+ महत्वपूर्ण String Methods को Syntax, Examples और Output सहित विस्तार से समझेंगे।

 

String Methods क्या हैं?

String Methods वे Built-in Functions हैं जो String Object पर विभिन्न प्रकार के Operations करने के लिए उपयोग किए जाते हैं।

Syntax

string.method_name()

उदाहरण

text = "python"

 

print(text.upper())

Output

PYTHON

 

Python String Methods की सूची

Python के String Methods को समझने में आसानी के लिए इन्हें विभिन्न श्रेणियों में बाँटा जा सकता है—

  1. Case Conversion Methods
  • upper()
  • lower()
  • capitalize()
  • title()
  • swapcase()
  • casefold()

 

  1. Searching Methods
  • find()
  • rfind()
  • index()
  • rindex()
  • count()

 

  1. Replace & Remove Methods
  • replace()
  • removeprefix()
  • removesuffix()

 

  1. Split & Join Methods
  • split()
  • rsplit()
  • splitlines()
  • join()
  • partition()
  • rpartition()

 

  1. Trim Methods
  • strip()
  • lstrip()
  • rstrip()

 

  1. Alignment Methods
  • center()
  • ljust()
  • rjust()
  • zfill()

 

  1. Checking Methods
  • isalpha()
  • isdigit()
  • isnumeric()
  • isdecimal()
  • isalnum()
  • islower()
  • isupper()
  • istitle()
  • isspace()
  • isidentifier()
  • isascii()
  • isprintable()

 

  1. Formatting Methods
  • format()
  • format_map()
  • expandtabs()
  • encode()
  • maketrans()
  • translate()

 

  1. Prefix & Suffix Methods
  • startswith()
  • endswith()

 

सभी Methods की पूरी सूची

क्रम

Method

उपयोग

1

upper()

बड़े अक्षरों में बदलना

2

lower()

छोटे अक्षरों में बदलना

3

capitalize()

पहला अक्षर बड़ा करना

4

title()

प्रत्येक शब्द का पहला अक्षर बड़ा

5

swapcase()

Upper ↔ Lower बदलना

6

casefold()

Case-insensitive तुलना

7

find()

पहली Position खोजता है

8

rfind()

पीछे से खोजता है

9

index()

Position देता है

10

rindex()

पीछे से Position देता है

11

count()

कितनी बार आया

12

replace()

Text बदलना

13

split()

String विभाजित करना

14

rsplit()

पीछे से Split

15

splitlines()

Lines में बाँटना

16

join()

जोड़ना

17

partition()

तीन भागों में बाँटना

18

rpartition()

पीछे से Partition

19

strip()

दोनों ओर Space हटाना

20

lstrip()

बाईं ओर Space हटाना

21

rstrip()

दाईं ओर Space हटाना

22

center()

Center Alignment

23

ljust()

Left Alignment

24

rjust()

Right Alignment

25

zfill()

Zero Fill

26

startswith()

शुरुआत जाँचना

27

endswith()

अंत जाँचना

28

isalpha()

केवल Letters

29

isdigit()

केवल Digits

30

isnumeric()

Numeric Value

31

isdecimal()

Decimal Digits

32

isalnum()

Letters + Numbers

33

isspace()

केवल Space

34

islower()

Lowercase Check

35

isupper()

Uppercase Check

36

istitle()

Title Case Check

37

isidentifier()

Valid Identifier

38

isascii()

ASCII Check

39

isprintable()

Printable Characters

40

encode()

Encoding

41

expandtabs()

Tab Expand

42

format()

Formatting

43

format_map()

Dictionary Formatting

44

maketrans()

Translation Table

45

translate()

Characters बदलना

46

removeprefix()

Prefix हटाना

47

removesuffix()

Suffix हटाना

 

आगे इस Series में क्या होगा?

अब इस Master Guide के बाद हर Method का Dedicated Article बनाया जाएगा।

उदाहरण—

  1. upper() Method in Python
  2. lower() Method in Python
  3. capitalize() Method in Python
  4. title() Method in Python
  5. swapcase() Method in Python
  6. casefold() Method in Python
  7. find() Method in Python
  8. replace() Method in Python
  9. split() Method in Python
  10. join() Method in Python

निष्कर्ष (Conclusion)

Python String Methods की पूरी जानकारी हिंदी में। upper(), lower(), strip(), replace(), split(), join(), find(), count(), startswith(), endswith(), isalpha() सहित 40+ String Methods उदाहरण और Practical Programs के साथ सीखें।