alias str.join in python… here is a solution to the problem.
alias str.join in python
Is it possible to add an alias for str.join
in python3?
For example:
a=['a','b','c']
j=str.join
''.j(a)
It can still be done
' '.j(a)
Use the same alias or a more generic alias to be able to use it like this:
string_here.j(iterable here)
Solution
Not exactly what you want the syntax, but close enough :
>>> a=['a','b','c']
>>> j=str.join
>>> j('', a)
'abc'
>>> j(' ', a)
'a b c'
str.join
is an unbound (bind) method. To apply it to an object, you need to specify the object as the first parameter.