python - How do I prevent `format()` from inserting newlines in my string? -


it might mistake, cmd = 'program {} {}'.format(arg1, arg2) newline between 2 args... program 1\n2

what should put them in 1 line (cmd need passed system shell)?

arg1 contains \n. use strip()

cmd = 'program {} {}'.format(arg1.strip(), arg2.strip()) 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -