一、第一个程序
- 交互式输入第一个程序
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #@Author: Tom #@Time: 2024/4/5 22:25 # 定义变量 Google_Mail = "[email protected]" # 允许交互式输入并赋值给对应的变量 Google_Url = input("Please Input Google The Url:") print("邮箱登录地址:%s" %Google_Url) print("您的邮箱:%s" %Google_Mail) print("交互式输入变量值类型:%s"%type(Google_Url)) print("转换后的变量值类型:%s"%type(int(Google_Url))) """ 交互式输入的变量值均是str类型,如需转义需进行强转(数字类型使用int(变量名)) int()转成数字类型、str()转成字符串类型、float()转成浮点数 住:如果变量值本身就是字符串类型强转别的类型是会报错的。 比如:输入的是www.baidu.com 使用int或其他强转到别类型时会报错 """
标签:int,Google,Python,变量值,print,Url,while,类型 From: https://www.cnblogs.com/Fu-Mac/p/18116308