स्ट्रिंग मैनिपुलेशन का परिचय

Python में Regular Expressions

Maria Eugenia Inzaugarat

Data Scientist

आप क्या सीखेंगे

  • String manipulation

    • जैसे, खास substrings को replace और find करना
  • String formatting

    • जैसे, किसी template में string interpolate करना
  • बेसिक और एडवांस्ड regular expressions

    • जैसे, string में complex patterns खोजना
Python में Regular Expressions

यह क्यों ज़रूरी है

  • टेक्स्ट माइनिंग या sentiment analysis के लिए डेटासेट साफ करें

  • ईमेल कंटेंट प्रोसेस करें ताकि एक machine learning एल्गोरिदम तय करे कि ईमेल स्पैम है या नहीं

  • वेबसाइट से विशिष्ट डेटा पार्स कर के निकालें और एक डेटाबेस बनाएँ

Python में Regular Expressions

Strings

  • अक्षरों का क्रम

  • Quotes

my_string = "This is a string"
my_string2 = 'This is also a string'
my_string = 'And this? It's the wrong string'
my_string = "And this? It's the correct string"
Python में Regular Expressions

और स्ट्रिंग्स

  • Length
my_string = "Awesome day"

len(my_string)
11
  • स्ट्रिंग में बदलें
str(123)
'123'
Python में Regular Expressions

कंकैटिनेशन

  • Concatenate: + ऑपरेटर
my_string1 = "Awesome day"
my_string2 = "for biking"
print(my_string1+" "+my_string2)
Awesome day for biking
Python में Regular Expressions

इंडेक्सिंग

  • Bracket notation

my_string = "Awesome day"
print(my_string[3])
s

 

print(my_string[-1])
y
Python में Regular Expressions

स्लाइसिंग

  • Bracket notation

my_string = "Awesome day"
print(my_string[0:3])
Awe

 

print(my_string[:5])
print(my_string[5:])
Aweso
me day
Python में Regular Expressions

Stride

  • Stride निर्दिष्ट करना

my_string = "Awesome day"
print(my_string[0:6:2])
Aeo

 

print(my_string[::-1])
yad emosewA
Python में Regular Expressions

अभ्यास करते हैं!

Python में Regular Expressions

Preparing Video For Download...