zoukankan      html  css  js  c++  java
  • Python基础三

    # input = input('age>>:')
    # input = int(input)
    # if input > 18:
    # print('大了')
    # elif input < 18:
    # print('小了')
    # else:
    # print('ok')
    # count = 0
    # while count <= 10:
    # print(count)
    # count += 1
    # count = 0
    # while count <= 10:
    # print(count)
    # count += 1
    # count = 1
    # while count <= 10:
    # if count == 7:
    # break
    # print(count)
    # count += 1
    # count = 1
    # while count <= 10:
    # if count == 4:
    # count += 1
    # continue # 跳过本次循环,后面的循环都不执行
    # print(count)
    # count += 1
    # name = input('name>>:')
    # paseword = input('paseword>>:')
    # if name == 'rambo' and paseword == '123':
    # print('登陆成功')
    # else:
    # print('用户名或者密码错误')
    # while True: # 全选+tab键 全部向前缩进 &&&&&&&&&&
    # # tab+shift键 全部向后缩进 **********
    # name = input('name>>:')
    # paseword = input('paseword>>:')
    # if name == 'rambo' and paseword == '123':
    # print('登陆成功')
    # else:
    # print('用户名或者密码错误')
    # count = 1
    # while True:
    # if count > 3:
    # break # break之后的都不运行了
    # name = input('name>>:')
    # paseword = input('paseword>>:')
    # if name == 'rambo' and paseword == '123':
    # print('登陆成功')
    # else:
    # print('用户名或者密码错误')
    # count += 1
    # count = 1
    # while True:
    # if count > 3:
    # break # break之后的都不运行了
    # name = input('name>>:')
    # paseword = input('paseword>>:')
    # if name == 'rambo' and paseword == '123':
    # print('登陆成功')
    # while True:
    # cmd=input('name>>:')
    # if cmd == 'sean':
    # break
    # print('run %s' %cmd) # 执行命令!执行命令!执行命令!执行命令!执行命令!执行命令!执行命令!
    # break # 结束本层循环
    # else:
    # print('用户名或者密码错误')
    # count += 1
    # count = 1
    # tag = True
    # while tag:
    # if count > 3:
    # break # break之后的都不运行了
    # name = input('name>>:')
    # paseword = input('paseword>>:')
    # if name == 'rambo' and paseword == '123':
    # print('登陆成功')
    # while tag:
    # cmd=input('name>>:')
    # if cmd == 'sean':
    # tag = False
    # continue
    # print('run %s' %cmd) # 执行命令!执行命令!执行命令!执行命令!执行命令!执行命令!执行命令!
    # else:
    # print('用户名或者密码错误')
    # count += 1
    # count = 0
    # while count < 7:
    # print(count)
    # count += 1
    # else:
    # print('当while在运行过程中没有被break打断时,执行')
    # count = 0
    # while count < 7:
    # if count == 4:
    # break
    # print(count)
    # count += 1
    # else: # 了解!!!!!!
    # print('当while在运行过程中没有被break打断时,运行')
    # 字符串里的单个字符是可以取出来的,
    # msg='hello world'
    # print(msg[0]) # 得到h 按照索引取值,正向取
    # print(msg[-1]) # 得到d 按照索引取值,反向取
    # 字符串是不可变类型,python中没有单个字符
    # print(msg[0:3])# =< 0 <3 切片,顾头不顾尾 hel
    # print(msg[0:7])# =< 0 <7 切片,顾头不顾尾 空格也算字符 hello w
    # print(msg[0:7:2])# =< 0 <3 切片,顾头不顾尾 步长为2 hlow
    # print(msg[5:0:-1])# =< 0 <3 切片,顾头不顾尾 倒着取 步长为1 olle
    # print(msg[-1:0:-1])# =< 0 <3 切片,顾头不顾尾 倒着取 步长为1 dlrow olle
    # print(msg[-1::-1])# =< 0 <3 切片,顾头不顾尾 倒着取 步长为1 dlrow olleh
    # print(msg.__len__()) # 11 长度
    # print(len(msg)) # 11 len调用 “msg.__len__() ”python内部调用的功能
    # 成员运算 in not in
    # print('llo' in msg) # True
    # 移除空白 strip 用法.strip()
    # password=' deicbricbr ' 用法.strip()
    # print(password.strip()) # deicbricbr 用法.strip()
    # password=input('>>:').strip() 用法.strip()
    # print(password) 用法.strip()
    # password='asdf 1234 ' 字符中间的空格不会去掉
    # print(password) # asdf 1234 字符中间的空格不会去掉
    # 切分 split
    # user_info='root:123:/1:asdf'
    # cmd=user_info.split(':') 命令符为:
    # print(cmd) # ['root', '123', '/1', 'asdf']
    # print(cmd[0]) # root
    # file='salary /kook1/book/asdf'
    # cmd=file.split()
    # print(cmd) # ['salary', '/kook1/book/asdf']
    # print(file.split()[0]) # salary
    # file='c:\a\b\c.txt'
    # print(file.split('\')[0]) # c:
    # print(file.split('\',1)) # ['c:', 'a\b\c.txt']
    # print(file.rsplit('\',1)) # ['c:\a\b', 'c.txt']
    # msg='hello world'
    # print(len(msg))
    # n = 0
    # size=len(msg)
    # while n < size:
    # print(msg[n])
    # n += 1
    # for i in msg:
    # print(i)
  • 相关阅读:
    Ios8代码关闭输入预测问题
    iOS10 拍照崩溃问题
    iOS 圆的放大动画效果
    12-指针
    11-数组、字符串
    09-函数
    iOS 动画
    iOS 传值 委托(delegate)和block 对比
    IOS Table中Cell的重用reuse机制分析
    IOS 网络请求
  • 原文地址:https://www.cnblogs.com/0B0S/p/11901368.html
Copyright © 2011-2022 走看看