[Tutor] problem with back slash
Dennis Lee Bieber
wlfraed at ix.netcom.com
Wed Feb 23 20:18:24 EST 2022
On Wed, 23 Feb 2022 11:37:59 -0800, Alex Kleider <alexkleider at gmail.com>
declaimed the following:
>I've written myself a little utility that accepts a text file which
>might have very long lines and returns a file with the same text but
>(as much as possible) with the lines no longer than MAX_LEN
>characters. (I've chosen 70.)
"\" would be a problem for string literals, but shouldn't matter for
text read from an external file.
<SNIP>
Seems rather complex to be working with individual lines. I'd probably
start with the standard library textwrap module, though you may need to add
some detection for indented lines to be handled special.
Compare
"""
mport textwrap
with open("Example.txt", "r") as fin:
with open("Output.txt", "w") as fout:
paragraph = []
for ln in fin:
ln = ln.rstrip()
paragraph.append(ln)
if not ln:
paragraph = " ".join(paragraph)
paragraph = textwrap.fill(paragraph, width=50)
fout.write("%s\n\n" % paragraph)
paragraph = []
if paragraph:
paragraph = " ".join(paragraph)
paragraph = textwrap.fill(paragraph, width=50)
fout.write("%s\n\n" % paragraph)
"""
Input file
"""
https://superuser.com/questions/1313241/install-windows-10-from-an-unbooted-oem-drive-into-virtualbox/1329935#1329935
You can activate Windows 10 using the product key for your hardware which
is embedded in the BIOS in an ACPI table called MSDM (Microsoft Data
Management). You can get it like this (from Linux, of course!):
$ sudo tail -c +56 /sys/firmware/acpi/tables/MSDM
ABA2D-TEFJ4-D97PT-9B42Y-H3U5E
You can apply the OEM Windows license to a VirtualBox guest like this (from
the Linux host - assuming VM is called win10):
$ sudo cat /sys/firmware/acpi/tables/MSDM > ~/VirtualBox\
VMs/win10/msdm.bin
$ VBoxManage setextradata win10 \
"VBoxInternal/Devices/acpi/0/Config/CustomTable" \
~/VirtualBox\ VMs/win10/msdm.bin
With that in place, Windows will not ask for a product key during
installation, it will activate automatically. If you want to verify that it
does indeed use the correct key you can use a tool like ShowKeyPlus to
check it. You can read about ShowKeyPlus on TenForums or download it here.
"""
Output file
"""
https://superuser.com/questions/1313241/install-
windows-10-from-an-unbooted-oem-drive-into-
virtualbox/1329935#1329935
You can activate Windows 10 using the product key
for your hardware which is embedded in the BIOS in
an ACPI table called MSDM (Microsoft Data
Management). You can get it like this (from Linux,
of course!):
$ sudo tail -c +56 /sys/firmware/acpi/tables/MSDM
ABA2D-TEFJ4-D97PT-9B42Y-H3U5E
You can apply the OEM Windows license to a
VirtualBox guest like this (from the Linux host -
assuming VM is called win10):
$ sudo cat /sys/firmware/acpi/tables/MSDM >
~/VirtualBox\ VMs/win10/msdm.bin $ VBoxManage
setextradata win10 \
"VBoxInternal/Devices/acpi/0/Config/CustomTable" \
~/VirtualBox\ VMs/win10/msdm.bin
With that in place, Windows will not ask for a
product key during installation, it will activate
automatically. If you want to verify that it does
indeed use the correct key you can use a tool like
ShowKeyPlus to check it. You can read about
ShowKeyPlus on TenForums or download it here.
"""
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed at ix.netcom.com http://wlfraed.microdiversity.freeddns.org/
More information about the Tutor
mailing list