摘要:
这是一个可以循环到天荒地老的循环: 如果while 为真就一直循环下去: 阅读全文
摘要:
算术运算符: 比较运算符: 赋值运算符: 位运算符: 逻辑运算符: 身份运算符: 成员运算符: 运算符优先级: 分类: python 分类: python 阅读全文
摘要:
dir(os)查看类包含的方法help(os)查看帮助dir()可以直接查看当前已经定义的类、方法、或者变量名。 阅读全文
摘要:
name=[1,5,9,3,2,4,7,9,5,6,2,9,9,8,55,5,5,5,2,6,9,9,89,4,22,2,999,2,2,2,54] name2=[1,3,5,7,9] name.append(9999)#在列表中追加元素 name.remove(1)#删除一个元素 name.insert(5,123456)#在指定位置插入元素 name.pop(10)#删除指定元素 name... 阅读全文
摘要:
region_list={"河北省":{"石家庄":["新乐","新集","赵县"],"保定":["唐县","满城","涞源"]}, "山西":{"太原":["小店区","杏花岭区"],"大同":["大同县","西花园"]}} def the_menu(): print(&quo 阅读全文
摘要:
import os import sys res=os.popen("df").read()#获取程序执行结果 res=os.popen("ipconfig").read() print(res) l=sys.path#打印的环境变量 print(l)#当你导入一 阅读全文
摘要:
for i in range(10): if i< 3: user_name=int(input("请输入用户名:")) pass_word=int(input(" 请输入密码:")) theuser_file = open("123","r") username=int(theuser_file.readline())#文件... 阅读全文
摘要:
age=22 counter=0 for i in range(10): if counterage: print("太大了") else: print("太小了") else: continue_isntit=input("你猜了太多次了真笨是否继续?输入:q 继续") if con... 阅读全文
摘要:
import getpass #实现密文输入密码的标准库 username=input("username:") password=getpass.getpass("password")#getpass在pychrm不好使,只能在linux系统用或者在windows命令行用 print("username,password") 阅读全文
摘要:
#coding:utf-8 import urllib2 import cookielib url="http://www.baidu.com" print '方法 1' response1=urllib2.urlopen(url) print response1.getcode()#验证打开网页是否成功,成功返回200 print len(response1.read())#打印读取网页... 阅读全文