#!/usr/bin/env python
# -*- coding:utf-8 -*-
# with open("aaa",'r+',encoding='utf-8') as f:
# data = f.read(1)
# # print(data)
# print(f.tell())
# f.write('hello')
# print(f.tell())
# with open('aaa','r+') as f1 ,open('aaa','a+') as f2:
# print(f1.tell())
# print(f1.read())
# data = f1.truncate()
# print(data)
# user = input('请输入用户名:')
# pwd = input("请输入密码:")
#
# with open('db', 'r+') as f1:
# for i in f1:
# # 默认strip没参数,空格,换行符自动去除,
# # 有参数:移除两侧指定的值
# i = i.strip()
# line_list = i.split('$')
# if user == line_list[0] and pwd == line_list[1]:
# print("登录成功")
# break
# else:
# print("账号或密码错误")
# continue
# def register(user, pwd):
# """
# 注册用户
# 1、打开文件
# 2、追加数据
# 3、用户名和密码用$连起来
# :param user:
# :param pwd:
# :return:
# """
# with open('db', 'a') as f3:
# temp = '\n' + user + "$" + pwd
# f3.write(temp)
# print("注册成功")
#
# def user_exist(user):
# """
# 验证用户名是否存在
# :param user:
# :return: 存在返回True
# """""
# with open('db', 'r', encoding='utf-8') as f2:
# for i in f2:
# i = i.strip()
# line_list = i.split('$')
# if user == line_list[0]:
# return True
# return False
#
# def main():
# print("欢迎登录")
# num = input("1:登录,2:注册")
# num = int(num)
# if num == 1:
# def login(user, pwd):
# """
# 用户名、密码的验证
# :param user: 用户名
# :param pwd: 密码
# :return: True,用户验证成功,False,用户验证失败
# """
# with open('db', 'r+') as f1:
# for i in f1:
# # 默认strip没参数,空格,换行符自动去除,
# # 有参数:移除两侧指定的值
# i = i.strip()
# line_list = i.split('$')
# if user == line_list[0] and pwd == line_list[1]:
# return True
# return False
#
#
# while True:
# user = input('请输入用户名:')
# pwd = input("请输入密码:")
# is_login = login(user, pwd)
# if is_login:
# print('ok')
# break
# else:
# print('no')
# continue
# elif num == 2:
# user = input("请输入用户名:")
# pwd = input("请输入密码:")
# re_user = user_exist(user)
# if re_user:
# print('用户名已经存在')
# else:
# register(user, pwd)
#
# else:
# print("没这选项")
#
# main()
# a1 = 123
# a2 = 456
# a3 = 0
#
# a3 = a1
# a1 = a2
# a2 = a3
# print(a1)
# print(a2)
# li = [11,22,33,7]
# temp = li[0]
# li[0] = li[1]
# li[1] = temp
# print(li)
# li = [33, 5, 1, 2,3,2,1,4,231,3,3221,112]
# for i in range(1,len(li)):
# for k in range(len(li) - i):
# if li[k] > li[k + 1]:
# temp = li[k]
# li[k] = li[k + 1]
# li[k + 1] = temp
# print(li)
# def f(a1, a2):
# print(a2)
# if a1 >= 10000:
# return
# a3 = a1 + a2
# r = f(a2, a3)
# f(0, 1)
# def f5(deepth, a1, a2):
# print(deepth)
# if deepth == 10:
# return a1
# a3 = a1 + a2
# r = f5(deepth + 1,a2,a3)
# return r
# ret = f5(1,0,1)
# print(ret)