标签:pycharm space 输出 ... 打印 env trie bin 赋值
一、HelloWorld
#!/usr/bin/env python
#-*- coding:utf-8 -*-
print("HelloWorld!")
二、用户交互
#!/usr/bin/env python
#_*_coding:utf-8_*_
name
=
input
(
"What is your name?"
)
print
(
"Hello "
name )
输入密码时,如果想要不可见,需要利用getpass 模块中的 getpass方法,即:import
getpass
# 将用户输入的内容赋值给 name 变量
pwd
=
getpass.getpass(
"请输入密码:"
)
# 打印输入的内容
print
(pwd)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
name
=
"emily"
print
"i am %s "
%
name
#输出: i am emily
#!/usr/bin/env python
# -*- coding: utf-8 -*-
_username = ‘emily‘a = 30
count = 0
while count <3:
b = int(input("a:"))
if a == b:
print("yes")
break
elif a>b:
print("small")
else:
print("big")
count +=1
else:
print ("you have tried too many times..fuck off")
for i in range(10):
print(‘------‘,i)
for j in range(10):
print(j)
if j>5:
break
标签:pycharm space 输出 ... 打印 env trie bin 赋值
原文地址:http://www.cnblogs.com/yue427/p/6546896.html