I can successfully read from a file. However, I can't get an operation results to write.
For ex.:
i edited to include the full code with a recommended change
if 5:
from pathlib import Path
a = Path(r"C:\Users\l\Desktop\a.txt").read_text()
a = int(a)
qqa = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~'
def x(qqc, qqd):
qqe = []
while qqc > 0:
qqf = qqc % qqd
qqe.append(qqf)
qqc = qqc // qqd
qqg = []
while qqe:
qqg.append(qqa[qqe.pop()])
return ''.join(qqg)
b = open(r"C:\Users\l\Desktop\b.txt","w")
b.write(str(x(a,12)))
To explain this:
a.txt contains only the string “24” (excluding the quotes)
x is a base-10 to base-_ conversion operation
“12” is the base
I don't want the write operation to write the literal operation “x(a,12)” (excluding the quotes).
I want the write operation to write the result “20” (excluding the quotes). (“24” in base-12 is “20”.)
How can I get this to work properly in Python 3?
is 5?x()function would appear to be the single most important detail to your question - yet you have chosen to omit it completely. Or is the actual question how to write that function?