Python Basic data type

Source: Internet
Author: User

Basic data type:

Digital

String

Boolean value

List

Ganso

Dictionary

All objects have functions that are stored in the appropriate class.

View the class of an object, or the functionality that an object has.

1. View by Type ()

temp = "Alex"
t = Type (temp)

2. Overall view dir () quick list

temp = "Alex"
t = Type (temp)
Print (dir (t))

3. View a certain type of function

temp = "Alex"
t = Type (temp)
Help (Type (t))

4. Mouse click

temp = "Alex"

Temp.upper ()

Mouse on Upper (), ctr+ left button, auto-position to upper function

common features for basic data types:

integer int

N1 = 123
N2 = 456
Print (N1+N2)
Print (n1.__add__ (n2))

A1 = "Alex"
ret = A1.capitalize ()
Print (ret)


A1 = "Alex"
ret = A1.center (20, ' * ')
Print (ret)

A1 = "Alex is Alph"
ret = A1.count ("a")
Print (ret)

A1 = "Alex is Alph"
ret = A1.count ("Al", 0,10)
Print (ret)

temp = "Hello"
Print (Temp.endswith (' e ', 0,2))


Content = "hello\t999"
Print (content)
Print (Content.expandtabs ())
Print (Content.expandtabs (20))
s = "Alex Hello"
Print (S.find ("ex"))

s = "Hello {0}, Age{1}"
Print (s)
New1 = S.format (' Alex ', 19)
Print (New1)


Python Basic data type

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.