Python “sep” parameter in print()

Configurare noua (How To)

Situatie

The separator between the arguments to print() function in Python is space by default.

The ‘sep’ parameter is used to modified the separator between the arguments and can be made to any character.

Solutie

Pasi de urmat

print(‘Test1′,’Test2’, sep=”)
print(‘Test1′,’Test2′, sep=’-‘)
print(‘Test1′,’Test2′, sep=’@’)

Output:

Test1Test2
Test1-Test2
Test1@Test2

Tip solutie

Permanent

Voteaza

(7 din 14 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?