0% found this document useful (0 votes)
4 views2 pages

Python Data Collections Guide

The document is a module on Python programming focusing on data collections, specifically strings and regular expressions. It includes a table of string operations with their syntax, examples, and outputs, covering various functions like length, slicing, and case conversion. Key operations such as finding substrings, replacing characters, and checking string properties are also detailed.

Uploaded by

sandhiyababu1511
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Python Data Collections Guide

The document is a module on Python programming focusing on data collections, specifically strings and regular expressions. It includes a table of string operations with their syntax, examples, and outputs, covering various functions like length, slicing, and case conversion. Key operations such as finding substrings, replacing characters, and checking string properties are also detailed.

Uploaded by

sandhiyababu1511
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PMDS508L - Python Programming

Module – 4 – Data Collections

Prepared by: Dr. Nandhini S, SAS

Topics covered:

• Strings
• Regular Expressions
Table of string operations
Operation Syntax Example Output

Length of String len(s) len("India") 5

Slicing s[start:end:step] "Python"[1:5:2] yt

Uppercase [Link]() "hello".upper() HELLO

Lowercase [Link]() "HeLLo".lower() hello

Title Case [Link]() "hello world".title() Hello World

Swap Case [Link]() "Hello".swapcase() hELLO

Strip [Link]() " hello ".strip() hello


Find Substring [Link]("sub") "banana".find("na") 2

Replace Substring [Link]("a", "o") "apple".replace("a","o") opple

Split [Link](sep) "a,b,c".split(",") ['a', 'b', 'c']

Join 'sep'.join(list) "-".join(["a","b","c"]) a-b-c

Check isalpha() [Link]() "abc".isalpha() True

Check isdigit() [Link]() "123".isdigit() True

Startswith [Link]("py") "python".startswith("py") True

Endswith [Link]("on") "python".endswith("on") True

==================== END ====================

You might also like