摘要:
刚写了一个小游戏,突然发现忘了return 的作用,现在记下来: def game_start(): for i in range(1,4): points=[] point=random.randrange(1,7) a+=point return a 下面有函数要调用上面的game_start( 阅读全文
摘要:
#-*-coding:utf-8-*-import MySQLdbimport stringimport random#连接数据库conn=MySQLdb.connect( host='localhost', port=3306, user='root', passwd='Macro3', )#连接 阅读全文
摘要:
sql_insert = "insert into spring_user(id,nickname) values(%s,%s)" 待补充 阅读全文
摘要:
import randomimport stringa=list(string.ascii_uppercase)for i in range(1,10): a.append(str(i)) def active_code(geshu,length): for i in range(geshu): k 阅读全文
摘要:
s='123' s.append(str(9))pprint s 会报错:'str' onject has no attribute 'append' s=[ ] s.append(str(9)) print s ['9'] 阅读全文
摘要:
本地E盘上有一个why文件夹,why文件夹下有3个文件夹,分别是one,two,three,这三个文件夹下面分别有自己的txt文件: import osimport os.pathrootdir="E:\why" for zhu,ci,files in os.walk(rootdir): for f 阅读全文
摘要:
# -*- coding: utf-8 -*- import oswith open("C:\\Users\\Administrator\\Desktop\\yaojiang.txt","r") as f: print f.readline() 阅读全文
摘要:
昨晚搞鼓了一下python的open()打开文件 代码如下 def main(): infile =open("C:\Users\Spirit\Desktop\bc.txt",'r') data = infile.read() print(data)main() 然而结果总报错invaild arg 阅读全文
摘要:
两者的区别与共同之处 1、vdbench中的threads相当于fio的threads和depth 2、vdbench测试结果中的I/O相当于fio的iops;vdbench中的MB/sec相当于fio的BW带宽;vdbench的rest time相当于fio的时延 3、vdbench测试的是整个集 阅读全文
摘要:
先说1双引号与3个双引号的区别,双引号所表示的字符串通常要写成一行 如: s1 = "hello,world" 如果要写成多行,那么就要使用\ (“连行符”)吧,如 s2 = "hello,\ world" s2与s1是一样的。如果你用3个双引号的话,就可以直接写了,如下: s3 = """hell 阅读全文