ValueError with unpacking in python -
for code below, error valueerror: need more 1 value unpack
. reading txt file
5 different lines of content has more 1 line.
open("people.txt", 'r') infile: line in infile: ip,user,password = line.strip().split(',')
the text file looks this:
ip,username,password
answered @parchment in comments located here.
then blank line problem. should add together check blank lines. – parchment
sample useful recipe:
in [17]: open("src.txt") f: ...: f_ in f: ...: if f_.strip(): # 1 quick way check blank lines. ...: one_,two_ = f_.strip().split(",") ...: print one_, two_ foo bar spam grok in [18]:
python
No comments:
Post a Comment