Python Strings Basics # 1

 Python Strings Basics # 1
Okunuyor Python Strings Basics # 1

Python Strings Basics

  1. String Literals
  2. Multiline Strings
  3. Strings are Arrays
  4. Slicing
  5. String Length         There are String Basics

Python most useful libraries

String Literals

String literals in Python are surrounded by either single quotation marks. or double quotation marks.

Example:

1. X = “Follow”

2. Y = ‘Python’

Multiline Strings

You can assign a multiline string to a variable by using. three (single/double) quotes.

Exmple.

X = ””’Hi, have you already followed?””’

Strings Are Arrays

Like many other programming languages strings in Python are arrays of bytes representing unicode charactres.

However, Python does not have a character data type, a single character is simply a string with a lenght of 1.

Square brackets can be used to access elements of the string.

Example:

x = “Hello World”

print(x[1])  # Output: e

Slicing

You can return a range of characters by using the slice syntax.

Specify the start index and the end index, speperated by a colon, to return a part of the string.

Example:

x = “Good Behavior”

print(x[1:3]) # Output: oo

You can use negative indexes to start the slice form the end of the string.

Example:

x = “Good Behvaior”

print(x[-6:-3]) # Output: hva

String Length

To get the lenght of a string, you can use the len() function.

Example:

x = “Hello World”

print(len(x)) # Output: 11

GUI Development

  • Tekinter
  • PyGObject
  • PyQt
  • PySide

Web Development

  • Django
  • Pyramid
  • Bottle
  • Flask
  • Tornado

Scientific And Numerics

  • Pandas
  • Scipy
  • Ipython

Web Scrapping

  • Beautiful soup
  • Requests
  • Ixml
  • Scrappy

The today this are over subject.

  1. String Literals
  2. Multiline Strings
  3. Strings are Arrays
  4. Slicing
  5. String Length         There are String Basics

Python most useful libraries

And I hope this information has been useful to you.

Yapılan Yorumlar

Bir Cevap Yazın

This site uses Akismet to reduce spam. Learn how your comment data is processed.