newname_new
newname_new

Reputation: 17

Python random terminal 0

I am currently writing a Py script that uses

    import os
    newinput = raw_input(os.system("echo '\033[4;35m Hello \033[0m'")

But straight after that, I get this random zero And I can't seem to get rid of it

it looks like this

    user@user$ Hello 0

How do I get rid of this?

Upvotes: 1

Views: 205

Answers (3)

Hendri Tobing
Hendri Tobing

Reputation: 371

It seems you miss a ")" at the end of the second row.

Upvotes: 0

L3viathan
L3viathan

Reputation: 27333

Assuming you just want to have a colorful input, you can get rid of the os.system call and just do:

newinput = raw_input("\033[4;35m Hello \033[0m")

Upvotes: 2

Davis Yoshida
Davis Yoshida

Reputation: 1787

You are calling raw_input with the return value of os.system() as its argument. echo is returning an exit status of 0. raw_input prints its argument, so it is printing 0.

Upvotes: 5

Related Questions