#!/usr/bin/env python
#-*-Coding:utf-8-*-
# def F1 (x):
# return X>22
# ret = filter (f1,[11,22,33,44])
# ret = filter (lambda x:x>22,[11,22,33,44])
# for I in RET:
# Print (i)
# map
# def F1 (x):
# return x + 100
# ret = map (f1, [1, 2, 3, 4])
# Print (ret)
# for I in RET:
# Print (i)
# print (' ################### ')
# ret = map (lambda x:x + 100, [1, 2, 3, 4])
# for I in RET:
# Print (i)
# dic = {
# ' ff0 ': 1
# }
#
# ret = hash (' ff0 ')
# Print (ret)
#
# li = [11,22]
# #判断某个对象是否是某个类创建的
# r = isinstance (li,list)
# print (R)
#
# a = range (10)
# for I in A:
# Print (i)
# obj = iter ([11,22,33,44])
# ret = Next (obj)
# ret2= Next (obj)
# Print (ret)
# Print (Ret2)
# li = [11,22,12,323,132]
# r = Max (LI)
# print (R)
# r = min (li)
# print (R)
# i = POW (2,10,10) #基数, sub-side, take surplus
# Print (i)
# rounding
# r = Round (3.3)
# print (R)
# li = [11,22,33,44]
# # for I in Li:
# # print (i)
# li2 = [' A ', ' B ', ' C ', ' d ', ' F ']
# ret = Zip (li,li2)
# for I in RET:
# Print (i)
# Convert numbers into letters: CHR (number)
# i = Chr (65)
# Print (i)
# import Random
# temp = '
# for I in range (6):
# NUM1 = Random.randrange (0,4)
# if NUM1 = = 3 or NUM1 = = 1:
# num3 = Random.randrange (0,10)
# temp +=STR (NUM3)
# Else:
# num = Random.randrange (65, 91)
# c = chr (num)
# temp + = C
# Print (temp)
# li = [1,3,441,11,22,32,2]
# a = sorted (LI)
# Print (a)
# li=[' B ', ' A ', ' AC '
# a = sorted (LI)
# Print (a)
# 1, open file 2, action file 3, close file
# Open (file name/path, mode (read only) (write only), etc., encoding) default is read-only mode ' R '
# f = open (' ... /test ', ' R ')
# read-only
# data = F.read ()
# write only, and empty the contents of the original file, if not the file is created, W
# f = open (' ... /test ', ' W ')
# f.write (' 123 ')
# print (f)
# write-only mode "unreadable, does not exist, is created, there is an error" X
# f = open (' D:/test.txt ', ' x ')
# f.write (' 111 ')
# print (f)
# Append mode, unreadable, non-existent then create a
# f = open (' ... /test ', ' a ')
# f.write (' 123 ')
# F.close ()
# byte Way Open read-only, RB
# f = open (' ... /test1 ', ' RB ')
# data = F.read ()
# Print (Type (data))
# Print (data)
# F.close ()
# f = open (' ... /test ', ' R ', encoding= ' utf-8 ')
# data = F.read ()
# F.close ()
# Print (data)
# # 1, read-only, RB
# f = open (' ... /test ', ' RB ')
# data = F.read ()
# F.close ()
# Print (data)
# r+
# f = open (' Test ', ' r+ ', encoding= ' utf-8 ')
# Print (F.tell ()) #获取当前指针
# data = F.read (3)
# Print (F.tell ()) #获取当前指针
# Print (Type (data), data)
# f.write (' ~~~FDAFDA ')
# f.seek (0) #让指正回到起始位置
# data = F.read ()
# Print (Type (data), data)
# F.close ()
# w+ first empty, rewrite before you can read
# f = open (' Test ', ' w+ ', encoding= ' utf-8 ')
# f.write (' FFFFF!!! ')
# f.seek (0)
# data = F.read ()
# Print (data)
# F.close ()
# x+ error if file exists
# A + opens while the pointer is at the end
# f = open (' Ha ', ' A + ', encoding= ' utf-8 ')
# f.seek (0)
# data = F.read ()
# Print (data)
# F.close ()
# F.tell () Gets the position of the pointer
# F.seek (num) Adjust the position of the pointer
# f.write () write content
# f.read () Read content
# f = open (' Ha ', ' r+ ', encoding= ' utf-8 ')
# temp = F.readline () #只读取一行
# F.flush ()
# #依赖于指针
# f.truncate ()
# f.write (' FFFF ')
# Print (temp)
#
# F.close ()
# f = open (' Ha ', ' r ', encoding= ' utf-8 ')
# for line in F:
# Print (line)
# F.readline ()
# f = open (' Ha ', ' r ', encoding= ' utf-8 ')
# d = open (' Test ', ' W ')
# for line in F:
# D.write (line)
# F.close ()
# D.close ()
# def f3 (ARG):
# print (' AAA ')
# def x ():
# print (' bbbb ')
# f3 (x)
# arg = = function, arg () Execute function
# arg =>arg is a variable
# result = []
# def Myfilter (FUNC,SEQ):
# for I in SEQ:
# e = func (i)
# if E:
# result.append (i)
# return result
# def F1 (x):
# if x>22:
# return True
# Else:
# return False
#
# a = Myfilter (f1,[11,22,33,44,55])
# Print (a)
# res = []
# li = [11, 22, 33, 44, 55]
#
#
# def X (ARG):
# return ARG + 100
#
#
# def MYMAP (Fun,arg):
# for I in ARG:
# ret = Fun (i)
# res.append (ret)
# return Res
# a = MyMap (X,li)
# Print (a)
Eighth Day of Learning Python