โค้ด: เลือกทั้งหมด
EntityRef: expecting ';', line 4185, column 253: (<class 'lxml.etree.XMLSyntaxError'>, XMLSyntaxError(u"EntityRef: expecting ';', line 4185, column 253",), <traceback object at 0x05C7E2B0>)
Moderator: mindphp, ผู้ดูแลกระดาน
โค้ด: เลือกทั้งหมด
EntityRef: expecting ';', line 4185, column 253: (<class 'lxml.etree.XMLSyntaxError'>, XMLSyntaxError(u"EntityRef: expecting ';', line 4185, column 253",), <traceback object at 0x05C7E2B0>)
โค้ด: เลือกทั้งหมด
.encode('ascii', 'xmlcharrefreplace')
โค้ด: เลือกทั้งหมด
encode('ascii', 'ignore')
โค้ด: เลือกทั้งหมด
encode('utf-8','replace')
โค้ด: เลือกทั้งหมด
str = name
substr1 = "&"
substr2 = " "
name = "%s" % str.replace(substr1, substr2)
ได้ 1 วิธีthatsawan เขียน:เจอปัญหาเเล้วค่ะ
นอกจาก & มาเจอที่ < เเละ >
เเต่ยังไม่รู้จะแก้ปัญหายังไง เเบบที่ไม่ต้องมาเช็คค่าที่ละตัว
โค้ด: เลือกทั้งหมด
rep_chars = ['\\', '/', ':', '*', '?', '"', '<', '>', '|']
name = "/:*?\"<>name"
for char in rep_chars:
name = name.replace(char,'')
print name
โค้ด: เลือกทั้งหมด
import re
name = "/:*?\"<>& name"
newName = re.sub('[\\\\/:*?"<>|&]', 'newname ', name)
print newName
สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 117