cannot concatenate 'str' and 'list' objects

Peter Otten __peter__ at web.de
Sat Sep 15 10:29:29 EDT 2012


Νικόλαος Κούρας wrote:

> Τη Σάββατο, 15 Σεπτεμβρίου 2012 4:38:51 μ.μ. UTC+3, ο χρήστης Chris
> Angelico έγραψε:
>> On Sat, Sep 15, 2012 at 11:28 PM, Νικόλαος Κούρας <nikos.gr33k at gmail.com>
>> wrote:
>> 
>> > Iam not using frameworks just plain python code written in Notepad++
>> 
>> >
>> 
>> > Can you please tell me how to switch this line in order for this line
>> > to work?
>> 
>> 
>> 
>> f = open( '../' + page[0])
>> 
>> 
>> 
>> will possibly work. But do try to understand what's happening, rather
>> 
>> than simply solve the problem. You may find that something else has
>> 
>> changed too.
>> 
>> 
>> 
>> ChrisA
> 
> i see you try to extract only the 1st element of the list, i tried that
> too but it gives me now this weird message:
> 
> if you visit my website http://superhost.gr

You seem to have encoding problems:

>>> print '\xc4\xe5\xed \xf5\xf0\xdc\xf1\xf7\xe5\xe9 
\xf4\xdd\xf4\xef\xe9\xef \xe1\xf1\xf7\xe5\xdf\xef \xde 
\xea\xe1\xf4\xdc\xeb\xef\xe3\xef\xf2'.decode("iso-8859-7")
Δεν υπάρχει τέτοιο αρχείο ή κατάλογος

That doesn't look weird (I'd guess) for someone who knows Greek...

Proceeding to

http://superhost.gr/cgi-bin/counter.py?page=foo.html

versus

http://superhost.gr/cgi-bin/counter.py?page=foo.html&page=bar.html

it turns out that you get a list as the page variable only in the latter 
case. So you might have provoked your initial problem by following a buggy 
url with a duplicate page argument.




More information about the Python-list mailing list