Now I know this is very stupid question....
I am trying to make something like a programming language in a programming language (python). This is my attempt to make the command "print".
progress = []
command_libary = []
command_split = []
def split_command(command):
command2 = command.split()
for x in command2:
command_split.extend(x)
command_libary.extend(command)
def C05(command3):
split_command(command3)
if (command_split[0] == "p" and command_split[1] == "r" and command_split[2] == "i" and command_split[3] == "n" and command_split[4] == "t" and command_split[5] == "("):
for x in range(6, len(command_split)):
if command_split[x] == ")":
break
progress.extend(command_split[x])
print (", ".join(progress))
command_split.pop()
C05("print(something)")
But it give me this:
s, o, m, e, t, h, i, n, g,
Are there in python commands with I can replace join and get:
something
Change print(", ".join(progress))
to print("".join(progress))
join()
returns a string in which all elements of sequence have been joined by str
separator.
If you replace this line:
print (", ".join(progress))
with
print ("".join(progress))
it'll give you what you want.
I do not understand, why you have use
print (", ".join(progress))
?
maybe you can use:
print ("".join(progress))
for example:
>>>''.join(['0','1','2'])
'012'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.