Python output data print, obtain input data input, Basics

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/weixin_45523154/article/details/102730809

A, print output

The default print output is the new line, if you want to achieve does not wrap need to add at the end of the variable end = ""

Such as:

print output

After the implementation of the default print wrap

Such as:

print executing the default line break

print sep separator

Such as:

Separator

Scenario: the amount of consumption Output

Application delimiter

print the output to a file

The output to a file

Two, input input

print output, input receiving an input keyboard

input () function, built-in functions are python, receive any type of input data, all the data input, for processing is defined as a string, and returns the string type.

** such as: ** Enter the name, gender input, and print; enter more complicated

input input

Simplification: Enter the name, gender input, and print

input reduced input

In python3 in input () received a default str type. All characters entered, the system will be as string

The **: ** inputs two numbers, the sum of the sum of two numbers

input input

对Python感兴趣或者是正在学习的小伙伴,可以加入我们的Python学习扣qun:784758214,看看前辈们是如何学习的!从基础的python脚本到web开发、爬虫、django、数据挖掘等,零基础到项目实战的资料都有整理。送给每一位python的小伙伴!每天都有大牛定时讲解Python技术,分享一些学习的方法和需要注意的小细节,点击加入我们的 python学习者聚集地

eval函数特点:

1 只能一次输入多个函数,不能是字符串

2 输入后自动转为int类型

如:输入两个数,求两个数之和

eval函数

所以类似于 num01, num02 = 100, 200

Guess you like

Origin blog.csdn.net/weixin_45523154/article/details/102730809