摘要:cores_multicast = [[] for i in xrange(64)]temp_list = [0, 1]temp_list2 = [0, 3]cores_multicast[0].append(temp_list)cores_multicast[0].append(temp_list2)print cores_multicastprint cores_multicast[0]print cores_multicast[0][0]print cores_multicast[0][0][0]print cores_multicast[0][0][1]>>> ===
阅读全文
摘要:1 import re 2 p = re.compile(r'^(task_cnt\s)\S*\s\S$', re.M) 3 for i in range(0, 11): 4 filename = 'graph' + str(1000 + 100 * i) + '.tgffopt' 5 fp_o = open(filename, 'r') 6 all = fp_o.read() 7 fp_o.close 8 print all 9 fp_i = open(filename, 'w')10 ...
阅读全文
摘要:正则表达式可以用拼接形式 (r' ' + str(i) + ' ') 来引入变量ipython hello.py fileopen.tgff 2找到fileopen.tgff 中符合 From t0_(\S*) TO t0_(\S*) 和 From t1_(\S*) TO t1_(\S*) 形式并提取group(1)和(2)分别写入文件t0.csv和t1.csv。#!/usr/bin/python#argv[1] is a filename; argv[2] is the number of graphimport re,sys,stringfp = open(
阅读全文