Hello there i was typing a python code and got this error saying:

     26 
     27 for eil in open("msgs.txt"): # nuskaito ir parodo visas zinutes
=>   28         date, person , msg = eil.split("#")
     29         print(date+person+"<b>"+msg+"</b><br> <hr>")
     30     
date = '', person = '', msg = ' ', eil = '----\n', eil.split = <built-in method split of str object>

ValueError: need more than 1 value to unpack
      args = ('need more than 1 value to unpack',)
      with_traceback = <built-in method with_traceback of ValueError object> 

I get the error in this part of code - 2nd line. My teacher posted this code for homework and i can't make it running any ideas?
If that helps im making this in python 3.3 and a localhost website in which this code is supposed to work.

Recommended Answers

All 2 Replies

Check that every line in msgs.txt consists of 3 items separated by #.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.