Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
for lin in openfile:
#3
The usage of what @buran link to.
uni_hello = 'hello Χαίρετε добры дзень 여보세요'

with open('uni_hello.txt', 'w', encoding='utf-8') as f_out:
    f_out.write(uni_hello)

with open('uni_hello.txt', encoding="utf-8") as f:
    print(f.read())
Output:
hello Χαίρετε добры дзень 여보세요
A couple of advice when all fails.
with open('some_file', encoding='utf-8', errors='ignore') as f:
with open('some_file', encoding='utf-8', errors='replace') as f:
ftfy fixes Unicode that’s broken in various ways.
Reply


Messages In This Thread
for lin in openfile: - by Skaperen - Jun-27-2018, 03:41 AM
RE: for lin in openfile: - by buran - Jun-27-2018, 06:50 AM
RE: for lin in openfile: - by snippsat - Jun-27-2018, 09:14 AM
RE: for lin in openfile: - by Skaperen - Jun-27-2018, 10:02 PM
RE: for lin in openfile: - by snippsat - Jun-27-2018, 10:48 PM
RE: for lin in openfile: - by Skaperen - Jun-28-2018, 02:01 AM
RE: for lin in openfile: - by snippsat - Jun-28-2018, 12:47 PM
RE: for lin in openfile: - by DeaD_EyE - Jun-28-2018, 02:19 PM
RE: for lin in openfile: - by Skaperen - Jun-28-2018, 08:53 PM
RE: for lin in openfile: - by snippsat - Jun-28-2018, 09:42 PM
RE: for lin in openfile: - by Skaperen - Jun-28-2018, 11:36 PM
RE: for lin in openfile: - by snippsat - Jun-29-2018, 07:52 AM
RE: for lin in openfile: - by Skaperen - Jun-29-2018, 09:59 PM
RE: for lin in openfile: - by snippsat - Jun-30-2018, 12:07 PM
RE: for lin in openfile: - by Skaperen - Jun-30-2018, 05:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  combobox_callback(choice choice part of openfile name (kind of dependency) janeik 9 1,657 Sep-10-2023, 10:27 PM
Last Post: janeik

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020