ikechi
ikechi

Reputation: 329

removing the question mark in python output

I'm trying to remove last character with [:-1] from the words that aren't written in latin alphabet (header has # -*- coding: utf-8 -*- set) and removed character gets replaced with ? in terminal output. Any suggestions?

code example:

# -*- coding: utf-8 -*-

word = "სკამი"[:-1]
print word

output in terminal

სკამ?

Upvotes: 0

Views: 2376

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799062

Stop using bytestrings.

print "სკამი".decode('utf-8')[:-1]
print u"სკამი"[:-1]

Upvotes: 1

Related Questions