Error : builtins.UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1 in position 448: invalid start byte
def quicksort(Info):
lesser=[]
greater=[]
if len(Info) <= 1:
return Info
for swap in Info[1:]:
if swap < Info[0]:
lesser.append(swap)
else:
greater.append(swap)
print(quicksort(lesser)+Info[0:1]+quicksort(greater))
a= ['Babado Novo: Ver-te Mar', 'Natas es Satan', 'All Out War', '"The Cell"', '¡Ja me maaten...!', '"Formula 1: BBC Sport"', 'Ambos mundos', 'Angels with Dirty Faces', 'Barrio Gangsters', 'The LXD: The Secrets of the Ra', '90 Jahre Burgenland', 'La guitarra muda', 'Alma gitana', 'Depravada', 'Especial humor: Vaya... y vuelta', 'Entre las patas de los caballos', 'Fillet of Soul', 'Llamada', 'All of Her', "Hustler's Untrue Hollywood Stories: Angelina vs. Jennifer", 'Black Tranny Whackers 12', '"Davno ne videlis"', 'Anna II', '"The American Experience"', 'Meus Prêmios Nick 2012', 'Possessed', 'Holzapfel weiß alles', 'Lightspeed University: Cheerleader Power', 'Kid Millions', 'Monster High', '"Big Brother\'s Bit on the Side"', '"Britain\'s Got Talent"', "Heut' kommt's drauf an", "Buffalo Jill's on DVD 2004: Swimsuit Edition", '"Sigue, sigue Plàstic"', '"Move Like Michael Jackson"']
quicksort(a)
first, add #coding=utf8
to the top of your script file,
second, save your file as utf-8, it may be ANSI by default.
then I get error running your code:
['"Big Brother\'s Bit on the Side"', '"Britain\'s Got Talent"']
Traceback (most recent call last):
File "D:\Documents\Desktop\a.py", line 23, in <module>
quicksort(a)
File "D:\Documents\Desktop\a.py", line 19, in quicksort
print(quicksort(lesser)+Info[0:1]+quicksort(greater))
File "D:\Documents\Desktop\a.py", line 19, in quicksort
print(quicksort(lesser)+Info[0:1]+quicksort(greater))
File "D:\Documents\Desktop\a.py", line 19, in quicksort
print(quicksort(lesser)+Info[0:1]+quicksort(greater))
File "D:\Documents\Desktop\a.py", line 19, in quicksort
print(quicksort(lesser)+Info[0:1]+quicksort(greater))
File "D:\Documents\Desktop\a.py", line 19, in quicksort
print(quicksort(lesser)+Info[0:1]+quicksort(greater))
TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.