i'm trying print message on screen , save in text file, if put variable first, print it, displays things like, , () don't want. i'm wondering how save print output variable, can write text file.
print("p", count, ": ", "".join(random.choice(chars) in range(length))) that have print as, if did this:
var = "p", count, ": ", "".join(random.choice(chars) in range(length)) it display v dont want to.
('p ', 314, ': ', 'zyiav')
you're looking format string syntax.
result = "p {}: {}".format(count, "".join(random.choice(chars) in range(length))) now result contains string in format desire , can printed well.
Comments
Post a Comment