Fork me on GitHub
# 格式化输出
# name=input('name<<:')
# age=input('age<<:')
# print('my name is %s,my age is %s'%(name,age))
# print('my name is [%s],my age is {%s}'%(name,age))
# print('my name is %s'%'Rambo')
# print('my name is %s'%100000000000)
# print('my age is %d'%18)
# %s可以接受数字和字符串,%d只能接受数字
# name=input('name<<:')
# age=input('age<<:')
# job=input('jub<<:')
# gender=input('gender<<:')
# info='''
# ==========info==========
# name:%s
# age:%s
# job:%s
# gender:%s
# ==========end==========
# '''%(name,age,job,gender)
# print(info)
# print('hello')
# obj=subprocess.Popen(
# cmd_str,shell=True,
# stdout=subprocess,BrokenPIPE,
# stderr=subprocess,BrokenPIPE,
# )
#
# success=obj.stdout.read().decode('gbk')
# if success:
# print(success,'正确的结果')
#
# error=obj.stderr.read.().decode('gbk')
# if error:
# print(error,'错误的结果')
# while True:
# phone_number=input('请输入您的手机号码:').strip()
# if len(phone_number) == 11 and (phone_number.startswith(
# '13'
# ) or (phone_number.startswith(
# '14'
# ) or (phone_number.startswith(
# '15'
# ) or (phone_number.startswith(
# '17'
# )):
# print('合法!')
# break
# else:
# print('您的手机号码不合法!')import re
# while True:
# phone_number = input('请输入手机号码:').strip()
# if re.match('^(13|14|15|19)[0-9]{9}$', phone_number):
# print('合法')
# break
# else:
# print('不合法')
# 算数:
# print(10/3)
# # print(10**3)
# # print(10//3)
# # print(10%3)
# 比较:比较的结果都是布尔值
# print(10 < 3)
# print(10 > 3)
# print(10 != 3)
# print(10 == 3)
# # 赋值:
# a=2
# b=a
# 交叉赋值:
# m=1
# n=2
# tem=m
# m=n
# n=tem
# print(m,n)
# m,n=n,m
# 解压赋值
# l=[1,2,3,4]
# a,b,c,d=l
# print(a)
# print(b)
# print(c)
# print(d)
# a,*_,d=l
# print(a,d)
# 逻辑:and,not,or
# print(not 4 > 2 or 3 > 2)
# not只跟最近的一个比较值
# *************************************************
# True or False and False
# print(True or False and False)
# print((True or False)and False)
# 结果不同**********************************************
# is_pretty本身就是一个布尔值
# score=input('<<:')
# print(score>=90)
# input将数字转换成了字符串,字符串不可以跟数字比大小
# int可以将输入的纯数字转换成整型int
# score=input('<<:')
# score=int(score)
# if (score>=90):
# print('优秀')
# elif (score < 90 and score >= 80):
# print('良好')
# elif(score < 80 and score >= 70):
# print('合格')
# else:
# print('滚犊子')
# score=input('<<:')
# score=int(score)
# if score >= 90:
# print('优秀')
# elif score >= 80:
# print('良好')
# elif score >= 70:
# print('合格')
# else:
# print('滚犊子')
posted on 2019-11-20 22:06  OBOS  阅读(161)  评论(0编辑  收藏  举报