看板 [ Python ]
討論串[問題] 請問各位大大問題
共 7 篇文章
首頁
上一頁
1
2
下一頁
尾頁

推噓0(0推 0噓 1→)留言1則,0人參與, 最新作者jeffreychen時間17年前 (2008/01/07 10:47), 編輯資訊
1
0
0
內容預覽:
想請問一下各位大大一個問題:. 例子:. 我有一個verilog file,想把所有的module_name 收集起來:. module AAA (. .. .. .. );. .. .. .. endmodule. AAA 是module_name 想請問各位大大要如何取得 AAA這個modue_

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者Lucemia (生の直感、死の予感)時間17年前 (2008/01/07 11:08), 編輯資訊
2
0
0
內容預覽:
like this?. import re. c = re.compile("module ([^\(]+) ("). module_name = set([k.strip() for k in c.findall(text)]). --. 發信站: 批踢踢實業坊(ptt.cc). ◆ From

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者jeffreychen時間17年前 (2008/01/07 11:21), 編輯資訊
1
0
0
內容預覽:
謝謝大大解答,. 但set([k.strip() for k in c.findall(text)]). 可以教我一下這function的說明嗎. --. 發信站: 批踢踢實業坊(ptt.cc). ◆ From: 220.128.190.162.

推噓0(0推 0噓 1→)留言1則,0人參與, 最新作者gasolin (小g)時間17年前 (2008/01/07 13:25), 編輯資訊
1
0
0
內容預覽:
近似於:. names = []. temp = c.findall(text). for k in temp:. names.append(k.strip()). module_name = set(names). Lucemia 的是 generator 的寫法.. --. 發信站: 批踢踢

推噓1(1推 0噓 0→)留言1則,0人參與, 最新作者jeffreychen時間17年前 (2008/01/07 13:30), 編輯資訊
1
0
0
內容預覽:
請問一下set()和findall(text). 這兩個function?. --. 發信站: 批踢踢實業坊(ptt.cc). ◆ From: 210.202.45.65.
首頁
上一頁
1
2
下一頁
尾頁