โดย thatsawan » 17/01/2020 5:18 pm
ลองใช้
ลองใช้
โค้ด: เลือกทั้งหมด
comment.encode(encoding='UTF-8',errors='strict')
โค้ด: เลือกทั้งหมด
import textwrap
wrapper = textwrap.TextWrapper(width=14)
res = wrapper.fill(text=comment)
อ้างจาก
viewtopic.php?f=144&t=61728&p=169868&hi ... ap#p169868
มีปัญหากับภาษาไทย ส่งออกมาเป็นภาษาต่างดาว และ error ascii
ลองใช้
[code]res = comment[0:14] + str('...') [/code]
ลองใช้
[code]comment.encode(encoding='UTF-8',errors='strict')[/code]
[code]encode('utf-8')[/code]
[code]encode('ascii')[/code]
[code] import textwrap
wrapper = textwrap.TextWrapper(width=14)
res = wrapper.fill(text=comment)[/code]
อ้างจาก https://www.mindphp.com/forums/viewtopic.php?f=144&t=61728&p=169868&hilit=textwrap#p169868
มีปัญหากับภาษาไทย ส่งออกมาเป็นภาษาต่างดาว และ error ascii