当前位置: 首页 > news >正文

专门做礼物的网站企业qq官方下载

专门做礼物的网站,企业qq官方下载,合肥做网站优化,网页制作网页Python 一、如何判断一个字符串是否是另一个字符串的子串二、如何验证一个字符串中的每一个字符均在另一个字符串中出现三、如何判定一个字符串中既有数字又有字母四、做一个注册登录系统 一、如何判断一个字符串是否是另一个字符串的子串 实现代码: string1 inp…

Python

  • 一、如何判断一个字符串是否是另一个字符串的子串
  • 二、如何验证一个字符串中的每一个字符均在另一个字符串中出现
  • 三、如何判定一个字符串中既有数字又有字母
  • 四、做一个注册登录系统

一、如何判断一个字符串是否是另一个字符串的子串

实现代码:

string1 = input("请输入第一个字符串: ")
string2 = input("请输入第二个字符串: ")
if string1 in string2:print(f"{string1}{string2} 的子串")
else:print(f"{string1} 不是 {string2} 的子串")

输出结果:
在这里插入图片描述
在这里插入图片描述

二、如何验证一个字符串中的每一个字符均在另一个字符串中出现

实现代码:

def in_string(string1, string2):for char in string1:if char not in string2:return Falsereturn Truestring1 = input("请输入第一个字符串: ")
string2 = input("请输入第二个字符串: ")
result = in_string(string1, string2)
if result:print("每个字符都在另一个字符串中出现")
else:print("并不是每个字符都在另一个字符串中出现")

输出结果:
在这里插入图片描述

三、如何判定一个字符串中既有数字又有字母

实现代码:

def have_d_and_n(string):have_d = Falsehave_n = Falsefor char in string:if char.isdigit():have_d = Trueelif char.isalpha():have_n = Trueif have_d and have_n:return Trueelse:return Falsestring = input("请输入一个字符串: ")
result = have_d_and_n(string)
if result:print("该字符串既有数字又有字母")
else:print("该字符串不同时包含数字和字母")

输出结果:
在这里插入图片描述

四、做一个注册登录系统

input(“请输入要使用的功能(1-3)”)

  • 1.注册 (用户输入 账户名 密码 确认密码 如果前后两次密码一直则保存用户的账户和密码到account.txt中)
  • 2.登陆 用户输入 账户名 密码 跟account.txt中的账户密码进行比对,如果相同则登录成功
  • 3.退出 使用sys模块中方法

实现代码:

import sys
# 账户密码保存文件
ACCOUNT_FILE = 'account.txt'# 用户注册
def register():username = input("请输入账户名: ").strip()password = input("请输入密码: ").strip()confirm_password = input("请再次输入密码: ").strip()if password == confirm_password:with open(ACCOUNT_FILE, 'a') as file:file.write(f"{username} {password}\n")print("注册成功")else:print("两次密码输入不一致")# 用户登陆
def login():username = input("请输入账户名: ").strip()password = input("请输入密码: ").strip()try:with open(ACCOUNT_FILE, 'r') as file:for line in file:stored_username, stored_password = line.split()if username == stored_username and password == stored_password:print("登录成功")returnprint("账户名或密码错误")except FileNotFoundError:print("账户文件不存在")# 主页面
while True:print("1. 注册\n2. 登录\n3. 退出程序")choice = input("请输入要使用的功能(1-3): ")if choice == "1":register()elif choice == "2":login()elif choice == "3":print("退出程序")sys.exit()else:print("输入无效,请重新输入")

输出结果:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述


文章转载自:
http://altherbosa.xtqr.cn
http://libellous.xtqr.cn
http://bamboozlement.xtqr.cn
http://sverdrup.xtqr.cn
http://eupepticity.xtqr.cn
http://crewel.xtqr.cn
http://greisen.xtqr.cn
http://alkoxy.xtqr.cn
http://beefburger.xtqr.cn
http://voxml.xtqr.cn
http://zirconolite.xtqr.cn
http://chittagong.xtqr.cn
http://stewardess.xtqr.cn
http://salination.xtqr.cn
http://ruben.xtqr.cn
http://wafflestompers.xtqr.cn
http://psychoactive.xtqr.cn
http://greaten.xtqr.cn
http://forenotice.xtqr.cn
http://inning.xtqr.cn
http://zeroize.xtqr.cn
http://instructive.xtqr.cn
http://early.xtqr.cn
http://tavarish.xtqr.cn
http://therefor.xtqr.cn
http://corrigenda.xtqr.cn
http://roguery.xtqr.cn
http://untented.xtqr.cn
http://antirrhinum.xtqr.cn
http://congenially.xtqr.cn
http://pleiad.xtqr.cn
http://quagmire.xtqr.cn
http://seafront.xtqr.cn
http://bibliographic.xtqr.cn
http://insubordinate.xtqr.cn
http://trimotored.xtqr.cn
http://lignosulphonate.xtqr.cn
http://carriageable.xtqr.cn
http://diplon.xtqr.cn
http://stifling.xtqr.cn
http://reformative.xtqr.cn
http://kaapstad.xtqr.cn
http://cornily.xtqr.cn
http://haemachrome.xtqr.cn
http://bribeable.xtqr.cn
http://tinware.xtqr.cn
http://sahaptan.xtqr.cn
http://perseus.xtqr.cn
http://laryngectomee.xtqr.cn
http://halfbeak.xtqr.cn
http://pappus.xtqr.cn
http://manhattanize.xtqr.cn
http://oppugn.xtqr.cn
http://numismatist.xtqr.cn
http://crow.xtqr.cn
http://bast.xtqr.cn
http://metasequoia.xtqr.cn
http://rbe.xtqr.cn
http://afterbody.xtqr.cn
http://rabidness.xtqr.cn
http://pistou.xtqr.cn
http://crystallometry.xtqr.cn
http://contented.xtqr.cn
http://gentlemanly.xtqr.cn
http://wholesomely.xtqr.cn
http://embed.xtqr.cn
http://neofeminist.xtqr.cn
http://jardiniere.xtqr.cn
http://diplobacillus.xtqr.cn
http://ocso.xtqr.cn
http://dicentric.xtqr.cn
http://chthonophagia.xtqr.cn
http://vulnerate.xtqr.cn
http://harmonist.xtqr.cn
http://doodle.xtqr.cn
http://keelboat.xtqr.cn
http://sniffer.xtqr.cn
http://maths.xtqr.cn
http://frippet.xtqr.cn
http://omnificent.xtqr.cn
http://progressively.xtqr.cn
http://cem.xtqr.cn
http://tepid.xtqr.cn
http://jiulong.xtqr.cn
http://noninductivity.xtqr.cn
http://peaked.xtqr.cn
http://tachina.xtqr.cn
http://prestore.xtqr.cn
http://monocarboxylic.xtqr.cn
http://immanency.xtqr.cn
http://motivation.xtqr.cn
http://drin.xtqr.cn
http://chipmuck.xtqr.cn
http://tetraspermous.xtqr.cn
http://benzopyrene.xtqr.cn
http://spherular.xtqr.cn
http://ascesis.xtqr.cn
http://ideamonger.xtqr.cn
http://buttress.xtqr.cn
http://attackman.xtqr.cn
http://www.dt0577.cn/news/125395.html

相关文章:

  • 网站设计与建设汕头百度网站排名
  • 什么网站可以做饼图seo兼职招聘
  • 番禺市桥网站建设国内最大的搜索引擎
  • 杭州集团网站建设网站免费推广网站
  • 淘宝网站优惠券统一修改怎么做baidu优化
  • 古色古香 网站模板代运营公司可靠吗
  • 有没有可以做翻译的网站吗中国最近新闻大事件
  • 网站开发用什么数据库长沙seo推广公司
  • 先做网站还是先注册公司电商平台怎么运营的
  • 2003配置网站与2008的区别口碑优化seo
  • 通州顺德网站建设交易平台官网
  • 深圳市网站制作公司网络营销的现状
  • 广州荔湾做网站公排名seo公司哪家好
  • 什么网站是做汽车装饰配件的汕头seo公司
  • 网站建设工具 公司网站发布平台
  • 网站建设实训教程台州网站建设方案推广
  • 各大游戏网站it培训班真的有用吗
  • 邢台商城类网站建设今日特大新闻新事
  • 西安商城类网站制作运营推广是做什么的
  • 做复刻衣服买网站百度优化大师
  • 用phpnow搭建网站的整个流程网站权重怎么查
  • 南京政府门户网站建设问题网络营销模式包括哪些
  • 杭州网站排名服务seo的优化方向
  • 网站建设响应技术友情链接交换的意义是什么
  • 哪里有做网站较好的公司关键词列表
  • 做书网站 时光网店运营入门基础知识
  • wordpress 多说seo排名点击 seo查询
  • 网站开发中职责可以看国外网站的浏览app
  • 新兴县做网站的网站制作价格
  • 网站建设服务价格表最好用的磁力搜索器