我有這樣的腳本:打印項目的當前數量在一個週期內對於x y中
accounts = open("accounts.txt").readlines()
y = [x.strip().split(":") for x in accounts]
for account in y:
print ("Trying with: %s:%s" % (account[0], account[1]))
文件accounts.txt是structred這樣的:
[email protected]:test1
[email protected]:test2
[email protected]:test3
我如何才能增加打印「試用... bla bla」帳戶的當前行嗎?等的輸出:
Trying with: [email protected]:test1 @1
Trying with: [email protected]:test1 @2
Trying with: [email protected]:test1 @3
[在Python訪問索引 '的' 循環]的可能的複製(http://stackoverflow.com/questions/522563/accessing-the- python-for-loops) –