#!/usr/bin/env python
#-*-Coding:utf-8-*-
# Single-line comments start with #
# first Comment
Print ("Hello, python!") # a second comment
‘‘‘
Third note
Iv. notes
‘‘‘
"""
Comment Five
Comment Six
"""
Print ("Hello, python!")
# Indent to be consistent or it will be an error
If True:
Print ("True")
Else
Print ("False")
If True:
Print ("Answer")
Print ("True")
Else
Print ("Answer")
Print ("False")
# Multi-line statement
# Python is usually a line to write a statement, but if the statement is long, we can use a backslash (\) to implement a multiline statement, for example:
# total = Item_one + \
# Item_two + \
# Item_three
# in [], {}, or () the multiline statement does not need to use a backslash (\), for example:
Total = [' Item_one ', ' item_two ', ' Item_three ',
' Item_four ', ' item_five ']
# number Type
# There are four types of numbers in Python: integers, long integers, floating-point numbers, and complex numbers.
# int (integer), such as 1, has only one integer-type int, represented as a long integer, and no long in Python2.
# bool (Boolean), as true.
# float (floating point), such as 1.23, 3E-2
# complex (plural), such as 1 + 2j, 1.1 + 2.2j
# string
Word = ' string '
Sentence = "This is a sentence." "
Paragraph = "" "This is a paragraph,
Can consist of multiple lines "" "
Str= ' Runoob '
Print (str) # output string
Print (str[0:-1]) # outputs all characters from the first to the penultimate
Print (str[0]) # The first character of the output string
Print (Str[2:5]) # Output characters from the third start to the fifth
Print (str[2:]) # outputs all characters from the beginning of the third
Print (str * 2) # output String two times
Print (str + ' hello ') # connection string
Print ('------------------------------')
Print (' Hello\nrunoob ') # Escape special characters with backslash (\) +n
Print (R ' Hello\nrunoob ') # adds an R to the front of the string, representing the original string, without escaping
# Wait for user input
Input ("\ n \ nthe exit after pressing the ENTER key.") ")
# Show multiple statements on the same line
Import SYS; x = ' Runoob '; Sys.stdout.write (x + ' \ n ')
# Import and From...import
# import the appropriate modules in Python with import or from...import.
# import the entire module (somemodule) in the format: import somemodule
# import a function from a module in the format: from Somemodule import somefunction
# import multiple functions from a module in the format: from Somemodule import Firstfunc, Secondfunc, Thirdfunc
# import all functions in a module in the format: from somemodule import *
# import SYS Module
Import Sys
Print (' ================python import mode========================== ')
Print (' command-line arguments: ')
For I in SYS.ARGV:
Print (i)
Print (' \ n python path is ', Sys.path)
python3.6 Basic Data-list-Ganso-string-dictionary 01