Python-Bai1

 cat /etc/*release

which python3


Sublime text 3, Visual studio code, Atom,...


feedparser

..

sudo apt install python3

...

PS C:\Users\haipv> py

...

C:\Users\haipv>python

...

which python3

cd /usr/bin/

sudo su

ln -s python3.8 python

ll python*

python

...

apt search python3-pip

pip install ssh2

pip3 install ssh2

python3.8

help()

modules

...

pip3 install flask

python3.8

import sys

sys.path

...

Yubikey ?

Yubico?

apt search python3

..

pip install yubico   # cai tu thu vien python

apt install python3-ybico # cai trong he dieu hanh

...

import os

os.getlogin()

..

help()

modules

help(os)

...

import sys

sys.path

...

apt install python3-venv

python3 -m venv environment_name

source environment_name/bin/source/active

deactivate

....

sudo apt install tree

tree -L 2 environment_name

which python3

..

echo $PATH

...

cat /etc/*release

system status abc

...

echo $SHELL

...

#!/usr/bin/env python3


#My information

my_name      = "Pham Van A"

my_age         = 15

my_grade      = 9.0

is_handsome = True

print(f"My name is {my_name}\n Age is {my_age})

print({my_grade})

.........

import os

os.linesep

....

print('a', 'b','c', sep='->')

print("Line 1", "Line 2", "Line 3", sep="\n")

...

import operator

a = 10

b = 2

operator.lt(a,b)

operator.gt(a,b)

operator.add(a,b)

operator.sub(a,b)

..........

type(bien)


...

from pprint import pprint

try:

     a  = int(input("Nhap vao so a: "))

     b  = int(input("Nhap vao so b:"))

except Exception as e:          # ValueError:

     pprint(e)

else:

     print(f"Tong cua a va ba la:{a + b}")

finally:

     print ("---Chuong trinh ket thuc---")

........

my_colors = ["red", "blue", "green"]

len(my_colors)

my_colors[1]

...

>>> my_colors = ["red", "blue", "green"]

>>> len(my_colors)

3

>>> my_colors[1]

'blue'

>>> my_colors[-1]

'green'

>>> my_colors[-2]

'blue'

>>> my_colors[-3]

'red'

..

my_colors.append("yellow")

my_colors

my_colors.extend(["black", "white"])

my_colors.append("black")

my_colors.count("black")

my_colors.index("black")

my_colors.insert(2, "purple")

my_colors

my_colors.clear()

..

a = [1]

b = [2]

a+b

a *2

c = a + b

c * 2

...

dir(my_color)

....

t=(1,2,3)

len(t)

t[2]

..

t = 1, 2, 4, ['a', 'b']

type(t)

t[3]

t[3][0]

t[3][0] = 'c'

t

.........................


Nhận xét